I think the closest you are likely to get is by using <xsl:output method="xhtml">. Certainly this should produce output that (a) is valid XML, and (b) displays correctly in the browser. Whether it is "valid" HTML 5 is an open question, since no-one quite knows what the word means.

Michael Kay

On 05/12/2012 00:41, Stephen W. Adcock wrote:

I am trying to create files that are both valid html5 and valid xml, but cannot find a combination of output options that will create such a thing. The problem arises with minimised tags.

For example, when I specify <xsl:output method=”html” version=”5.0” …, Saxon creates output such as <meta charset=”utf-8”> (i.e. no self-closing “/”), which is valid html5, but invalid xml. If I specify xml as my output method, then Saxon minimises all empty elements, for example <script type=”text/javascript” src=”script.js” />, but html5 requires <script type=”text/javascript” src=”script.js”></script>.  (The html validation error is “Self-closing syntax (/>) used on a non-VOID html element. Ignoring the slash and treating as a start tag.”)

Is there any way to output this mix of minimised and non-minimised elements?


Steve Adcock

Geological Survey of Canada


LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers

saxon-help mailing list archived at http://saxon.markmail.org/