2009-03-19

XHTML vs. HTML vs. MSIE; or, content-negotiation woes

“See, I like mah HTML in the raw. No sissy ‘editors’ or fancy-ass ‘templates’ for me, no sir. Gimme good old Emacs’ with an nxml-mode on the rocks like God wanted it. I write proper Appendix C–compliant XHTML 1.0 and the redfaces serve it and all is well.”

“Ah, but you see, friend, Appendix C sucks. Verily I say, if thou sendest them XHTMLs as text/html, then they’ll be tag-souped, so there’s no point. Thou might as well write the plainest HTML.”

Word. And further, I hate composing Appendix C code! I hate having to duplicate id and name and lang and xml:lang and I hate those lame spaces before slashes. It just defeats the purpose of choosing XHTML as the shorter format.

Way back then, when I still thought XML was a good idea, I decided to solve this with content negotiation and XSL. I wrote this stylesheet to convert XHTML 1.1 to HTML 4.01.

(more…)