All in the <head> – Ponderings and code by Drew McLellan –

XHTML 2.0 again

Although not particularly meaning to think about it, I accidentally began thinking about XHTML 2.0. This wasn’t tremendously desirable, as when I think about things I like to draw some sort of conclusion, and with XHTML 2.0 being so young (unfinished) and controversial, I was afraid of not being able to reach one. However, I had started thinking by this point so it was all somewhat irrelevant.

The big fuss about XHTML 2.0 is that although it is semantically rich and altogether more up-to-date architecturally, it fails to maintain an acceptable level of backwards compatibility with current version of XHTML and HTML and also the user agents in common use. Add its additional complexity (well, it’s hardly complex but it’s a fair bit more complex than simple HTML) and it becomes more difficult to use as well as consume. But …

Isn’t this just XML we’re talking about? XHTML 2.0 is just an application of simple XML, just as XHTML 1.0 was before it. The difference is that unlike its predecessor, XHTML 2.0 doesn’t try to match HTML 4.01 tag-for-tag. But, it’s just XML. It’s a language for marking up a web page in a meaningful (meaning-full) way. No one says that’s what has to be consumed by older user agents do they? Has the whole world lost its head and forgotten XSLT?

The important thing about XHTML 2.0 is that it enables a developer to mark up content for what it is. It’s this document that can be consumed by smart semantically-aware search engines. As for browsers, if they don’t understand XHTML 2.0 natively then I don’t give a stuff. Transform the document with XSLT to XHTML 1.0 and serve them that instead – programmatically. Those user agents that don’t understand XHTML 2.0 can’t make use of the extra information anyway, so transform to 1.0 and let them deal.
It’s not like you’d even need to write the XSLT yourself – once an XHTML 2.0 to XHTML 1.0 stylesheet has been written then it’s written – snag it, use it. You don’t even need to know what XSLT does. Surely it really is that simple? That’s what we have this technology for.

So, write once in XHTML 2.0. Serve twice – once in raw format for UAs than understand XHTML 2.0, once with a standard XSL stylesheet attached to transform into XHTML 1.0 at the server. Sounds like a good solution to me.

As I said, I didn’t mean to start thinking about it.