I just started on a xml document just for practicing xslt and I have a question about IDs. When using ID attribute, does the same rule apply about IDs as in “normal” HTML, only one pr. document? I added a book ID, but I want to have a ID on each author as well, then I can’t use 1 again right? And another short question, the naming of tags as I did here, naming the collection in plural and keeping each book as in this case in singular is that ok? Or are there better naming conventions?
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book id="1">
<title>An Introduction to XML and Web Technologies</title>
<authors>
<author>
<name>Anders Møller</name>
</author>
<author>
<name>Michael Schwartzbach</name>
</author>
</authors>
</book>
...
</books>
There is nothing in XML that prevents you from having multiple “objects” with the exact same attributes. XML doesn’t define the meaning of tags or attributes, only the format in which they are supposed to be written. (Also note that the order in which your “objects” appear in the XML file doesn’t have to be preserved by the parsers – neither during read-in or write-out.)
The interpretation/semantics if those tags/attributes is entirely up to the application to define.
Your naming convention looks fine to me, it’s quite clear and seems usual enough.