One of the better thought-out element vs attribute arguments comes from the UK GovTalk guidelines. This defines the modelling techniques used for government-related XML exchanges, but it stands on its own merits and is worth considering.
Schemas MUST be designed so that
elements are the main holders of
information content in the XML
instances. Attributes are more suited
to holding ancillary metadata – simple
items providing more information about
the element content. Attributes MUST
NOT be used to qualify other
attributes where this could cause
ambiguity.
Unlike elements, attributes cannot
hold structured data. For this reason,
elements are preferred as the
principal holders of information
content. However, allowing the use of
attributes to hold metadata about an
element's content (for example, the
format of a date, a unit of measure or
the identification of a value set) can
make an instance document simpler and
easier to understand.
A date of birth might be represented
in a message as:
<DateOfBirth>1975-06-03</DateOfBirth>
However, more information might be
required, such as how that date of
birth has been verified. This could be
defined as an attribute, making the
element in a message look like:
<DateOfBirth VerifiedBy="View of Birth Certificate">1975-06-03</DateOfBirth>
The following would be inappropriate:
<DateOfBirth VerifiedBy="View of Birth Certificate" ValueSet="ISO 8601" Code="2">1975-06-03</DateOfBirth>
It is not clear here whether the Code
is qualifying the VerifiedBy or the
ValueSet attribute. A more appropriate
rendition would be:
<DateOfBirth>
<VerifiedBy Code="2">View of Birth Certificate</VerifiedBy>
<Value ValueSet="ISO 8601">1975-06-03</Value>
</DateOfBirth>