Sunday, November 7, 2010

Outputting HTML5 via XML/XSLT

One of my web applications uses XSLT to transform some XML data into output. For a long time, I was convinced XHTML was the future. But now I've seen the light and HTML5 is the way to go. I want my app to be able to take advantage of all the HTML5 goodness while still retaining the content/view separation that using XML and XSLT has allowed me.

Content With Style had a good blog post highlighting this problem, but it seems that the doctype has since changed. The current HTML5 spec outlines the current accepted doctype including the doctype that XSLT-generated documents can use.

So here's the xsl:output string I needed to use:

<xsl:output method="html"
doctype-system="about:legacy-compat"
indent="yes"/>

No comments: