|
Summary
When creating semi-structured data and content-oriented documents, place human-readable text in elements, not attributes.
Elements vs. Attributes with Semi-Structured Documents
When creating semi-structured data and content-oriented documents, place human-readable text in elements, not attributes. This is because attributes are part of the structure, not the content. If you can separate structure from content, you can extract content without tags while retaining the human-readable information.
Text within an element should be considered viewable. Attribute values, on the other hand, are either invisible or rendered in some other way by a graphical object. Use attribute values to modify or further identify specific elements.
Examples,
<prompt type=boolean>Do you want the information? <choice value=true>Yes, please send the information</choice> <choice value=false>Don't send me the information</choice> </prompt>
<photo width=x height=y src=URL alt=Text if photo not rendered or on mouse-over> This is the caption for the photo. </photo>
If you follow this rule, the value-of XSL tag or nodeValue property in the XML DOM (or text property in the Microsoft XML DOM) can easily recondition the content for publication on an unformatted device, as illustrated below.
This following XSL statement
<xsl:value-of select=photo/>
produces the following text:
This is the caption for the photo.
Excepts from XML Unlocks Information: How XML Accommodates Human-Authored Content
| Further additional information | |
Updating comments...
Updating comments...
|