Troubleshooting

Problems with the Resulting HTML

I can process the style sheets without any problems, but the output HTML is invalid. Empty elements are given XML-style abbreviated closes like <this />, or the <!DOCTYPE > is incorrect.

First of all, be sure you have the following declaration in your style sheet:

<xsl:output method=”html” /> 

This will enable HTML output mode, producing valid HTML instead of XHTML.

If a <!DOCTYPE > is important in the output, the following declaration should be used:

<xsl:output method=”html” doctype-public=”-//W3c//DTD HTML 4.01//EN” 
                     doctype-system=”http://www.w3.org/TR/html4/strict.dtd” /> 

Problems Writing <SCRIPT> or <STYLE> Elements

I’m writing XSLT that creates an output HTML document with a <SCRIPT> ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.