“Sending XHTML as text/html Considered Harmful”


I’ve put de-xhtml up as a hack. It’s a simple transformation from XHTML to HTML, essentially the identity transformation with the right xsl:output attributes. It’s not all that complicated, but I couldn’t find it anywhere else.

Like all technology, it’s also a statement, in this case about the web’s implied evolution from tag soup to XHTML 2.0. Phrased in English, rather than code: broken XHTML presented as HTML is not a good migration path. Hixie’s essay goes into it in detail, and is an essential read for web cargo-cultists with even the vaguest concern for the future of the technology. Executive summary: the only reason to migrate to XHTML delivery is to guarantee an XML-aware user agent. If you’re serving as ‘text/html’, you don’t have that guarantee, and are really just throwing some more slashes into your tag soup. A lot of content that includes an XHTML doctype, put simply, isn’t; a lot of it’s not even well-formed XML, and most of it would break in subtler ways (those commented-out scripts - are you sure you know what that means?). Don’t waste time publishing in a largely academic syntax when the real benefits come from clean structure and separation of content and presentation. XHTML is perfect for content management and processing, but unless the client negotiates it, you should serve up plain HTML as plain HTML.

It’s hard to write about such low-level issues without it sounding like a pedantic or pointless idealistic point, when the obvious retort is just to point at IE 6’s frankly ludicrous market share and abandon all hope of a vendor-neutral web. Yes, but, no, but: wikis, blogging software, corporate browser rollouts, embedded browsers, information-rich intranets; all have an interest in pushing the state of the art forwards, rather than spending real time working around the many bugs in IE, and then yet more time breaking XHTML before it’s even in widespread use.

Okay, two dense text-only links, and an elitist rant masquerading as an XSL transformation; that’s hardly value for money. Here are some dancing pigs.

(Music: Urge Overkill, “Your Friend Is Insane”)
(More from this year, or the front page? [K])