Using XSLT to output the HTML 5 DOCTYPE

As far as I can tell, there is no way to make XSLT 1.0 or 2.0 output the

For example, <xsl:output method="html"/> results in no doctype at all.

<xsl:output method="html" doctype-public="" /> results in <!DOCTYPE html
PUBLIC "">, and it it appears pretty clearly stated this is correct in XSLT
1.0 [1]  I can't find anywhere in XSLT 2.0 that explicitly says that
resulting doctype should be correct, but it seems pretty well implied.

Should there be a way for XSLT to output the HTML 5 DOCTYPE?  If so, where
should that be specified?

Incidentally, <!DOCTYPE html PUBLIC ""> triggers css1compat mode in the
browsers I tested.

Also, an XSLT stylesheet that starts with a literal result element, such as:

<html xmlns:xsl="" xmlns="" xsl:version="1.0">
... resulted in no DOCTYPE at all.


I ran these tests using PHP5's XSL Functions, which uses libxslt,

Jon Barnett

Received on Friday, 13 July 2007 18:39:34 UTC