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