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
HTML 5 DOCTYPE.

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:

<!DOCTYPE HTML>
<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="
http://www.w3.org/1999/xhtml" xsl:version="1.0">
... resulted in no DOCTYPE at all.

[1] http://www.w3.org/TR/xslt#output

I ran these tests using PHP5's XSL Functions, which uses libxslt,
http://xmlsoft.org/XSLT/

-- 
Jon Barnett

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