[Skip navigation links]

HTML vs XHTML part 2

Posted by Mark Rogers on Dec 22, 2007 | 

Web Standards

In 2006 we converted our site from HTML 4.01 to XHTML 1.0. It seemed like it should be straightforward. After all, we reasoned, XHTML 1.0 is compatible with HTML so it should just be a case of changing the doctype from HTML to XHTML. Wrong.

Here is some legal HTML lifted from section 7 of the HTML 4.01 specification, which validates cleanly in the W3C validator:

  <TITLE>My first HTML document</TITLE>
  <P>Hello world!

If you run the same example through the W3C validator but choose an XHTML doctype every line triggers a validation error.

Why? The bulk of the problems stem from the fact that XHTML is case-sensitive, and all XHTML tags must be lowercase. This means none of the tags above are recognized because they’re uppercase.

HTML is case-insensitive and nearly all W3C HTML examples use uppercase tags, which means authors diligently following the spirit and letter of the HTML specifications have produced countless valid HTML pages, which are incompatible with XHTML. I have some sympathy for the authors of standard: XHTML is based on XML so had to be case-sensitive, and no matter which element case they chose someone was going to lose out. But it was unfortunate that authors following the W3C coding style lost out.


First posted Dec 2007