semantic-xhtml-design-principles: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Use singular name equivalents of plural names) |
||
Line 6: | Line 6: | ||
# Use the most accurately precise semantic XHTML building block for each object etc. | # Use the most accurately precise semantic XHTML building block for each object etc. | ||
# Otherwise use a generic structural element (e.g. <code><span></code> or <code><div></code>), or the appropriate contextual element (e.g. an <code><li></code> inside a <code><ul></code> or <code><ol></code>). | # Otherwise use a generic structural element (e.g. <code><span></code> or <code><div></code>), or the appropriate contextual element (e.g. an <code><li></code> inside a <code><ul></code> or <code><ol></code>). | ||
# Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters. | # Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters. Plural component names are changed to their singular equivalent names. | ||
# Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use <code><abbr></code> instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of <code><abbr></code>: [http://tantek.com/log/2005/01.html#d26t0100 Human vs. ISO8601 dates problem solved] | # Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use <code><abbr></code> instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of <code><abbr></code>: [http://tantek.com/log/2005/01.html#d26t0100 Human vs. ISO8601 dates problem solved] |
Revision as of 00:31, 18 September 2005
XHTML is built on XML, and thus XHTML based formats can be used not only for convenient display presentation, but also for general purpose data exchange. In many ways, XHTML based formats exemplify the best of both HTML and XML worlds. However, when building XHTML based formats, it helps to have a guiding set of principles.
- Reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported standards by reference. Avoid restating constraints expressed in the source standard. Informative mentions are ok.
- For types with multiple components, use nested elements with class names equivalent to the names of the components.
- Plural components are made singular, and thus multiple nested elements are used to represent multiple text values that are comma-delimited.
- Use the most accurately precise semantic XHTML building block for each object etc.
- Otherwise use a generic structural element (e.g.
<span>
or<div>
), or the appropriate contextual element (e.g. an<li>
inside a<ul>
or<ol>
). - Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters. Plural component names are changed to their singular equivalent names.
- Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use
<abbr>
instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of<abbr>
: Human vs. ISO8601 dates problem solved