I am writing an XML-sheet in which I manage a list of document types and a list of a document collection. It currently looks like this:
<collection>
<types>
<type id="T001">CD</type>
<type id="T002">Drawing</type>
<type id="T003">Book</type>
<type id="T004">Photo</type>
<type id="T005">Letter</type>
</types>
<languages>
<lang id="EN">English</taal>
<lang id="FR">French</taal>
</languages>
<documents>
<document>
<type>T001</type>
<lang>EN</lang>
</document>
<document>
<type>T003</type>
<lang>FR</lang>
</document>
<document>
<type>T001</type>
<lang>EN</lang>
</document>
<document>
<type>T002</type>
<lang>EN</lang>
</document>
<documents>
</collection>
I manage the types and languages lists within the XML sheet instead of using DTD entities so I can query those using XSL / Xpath.
As you can see the and elements are used in two different cases: in the first lists (types / languages) I use them as identifier, and later on I use them as reference element, but with the same node name. I am thinking it's not very neat using the same node name for both the identifier and the refering element. What would be another, neater way to do this?
It's just a matter of convention. Personally, I would change it to:
<documents>
<document>
<typeRef>T001</type>
<langRef>EN</lang>
...
Or:
<documents>
<document type="T001" lang="EN">
...