Reputation: 1258
While doing XSLT
transformation
at browser end Mozilla is treating <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
as plain text and putting it on webpage as first line, whereas IE is displaying the output correctly
Below is the xml and xsl to reproduce this issue
File Name - testdoctype.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testxdoctype.xsl"?>
<MainHeader>
<ReportType Label="report type">Test</ReportType>
</MainHeader>
File Name - testdoctype.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">
<![CDATA[
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
]]>
</xsl:text>
<div id="body">
<h1>REPORTS : <xsl:value-of select="./MainHeader/ReportType"/></h1>
</div>
</xsl:template>
</xsl:stylesheet>
Attached output images from IE and Mozila
Any Help to resolve this issue apart from server-side XSLT transformation?
Upvotes: 2
Views: 36
Reputation: 167696
Use XSLT as designed with an xsl:output
directive defining any doctype-public
and/or doctype-system
you want. The XSLT processor in Mozilla browsers does not support disable-output-escaping as it does not serialize the transformation result, instead it renders the result tree. See the FAQ https://developer.mozilla.org/en/docs/XSL_Transformations_in_Mozilla_FAQ#Can_I_do_disable-output-escaping.3F.
Upvotes: 2