XHTML 1.0: Where XML and HTML meet
Which old HTML sins to overcome?
The Ten Commandments of XHTML are:
- Fix up all documents that are not well-formed
Well-formedness is a new concept introduced by XML. Essentially this means that all
elements must be properly nested. Although overlapping is illegal in SGML, it was
widely tolerated in existing browsers.
NOT: <p>this is <em>emphasized</p></em>
BUT: <p>this is <em>emphasized</em></p>
- Change all tags and attribute names to lower case
XHTML documents must use lower case for all HTML element and attribute names.
XML is case-sensitive, so for instance <li> and <LI> are
different tags.
- Add end tags for non-empty elements
In SGML-based HTML 4 certain elements were permitted to omit the end tag; with the
elements that followed implying closure. This omission is not permitted in XML-based
XHTML. All elements other than those declared in the DTD as EMPTY must have an end tag.
NOT: <p>one<p>two
BUT: <p>one</p><p>two</p>
- Quote all attribute values
All attribute values must be quoted, even those which appear to be numeric.
NOT: <table rows=3>
BUT: <table rows="3">
- Unminimize attributes
XML does not support attribute minimization, attribute-value pairs must be written in full.
Attribute names such as compact and checked cannot occur in elements without their value
being specified.
NOT: <dl compact>
BUT: <dl compact="compact">
- Correctly tag empty elements
Empty elements must either have an end tag or the start tag must end with />.
For instance, <br/> or <hr></hr>. See below for information on
ways to ensure this is backward compatible with HTML 4 user agents.
NOT: <br><hr>
BUT: <br/><hr/>
next page

Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: http://www.webreference.com/xml/column6/2.html
Created: Feb. 07, 2000
Revised: Feb. 07, 2000