W3C home > Mailing lists > Public > public-html@w3.org > July 2007

Using XSLT to output the HTML 5 DOCTYPE

From: Jon Barnett <jonbarnett@gmail.com>
Date: Fri, 13 Jul 2007 13:39:27 -0500
Message-ID: <bde87dd20707131139q4cc56f76sbeff74a12dceee52@mail.gmail.com>
To: "HTML Working Group" <public-html@w3.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:46 UTC