I have a web page which executes some javascript upon a link click. The link is:
<a
href="javascript:void(0)"
onclick="XsltTransform('category.xml','category.xslt');">Latest news</a>
The javascript is:
<script type="text/javascript">
function XsltTransform(xmlfile, xslfile) {
var xml = document.implementation.createDocument("", "", null);
var xslt = document.implementation.createDocument("", "", null);
xml.async = false;
xslt.async = false;
xml.load(xmlfile);
xslt.load(xslfile);
var processor = new XSLTProcessor();
processor.importStylesheet(xslt);
var XmlDom = processor.transformToDocument(xml)
var serializer = new XMLSerializer();
var output = serializer.serializeToString(XmlDom.documentElement);
var outputDiv = document.getElementById("contentbody");
outputDiv.innerHTML = output;
}
</script>
The XML which is processed looks very much like:
<Content>
<Body><p>It may have taken over 12 years</Body>
</Content>
And the XSL which processes it is a simple xsl:value-of statement:
<xsl:template match="/">
<p>
<xsl:value-of select="*/*/Body" disable-output-escaping="yes" />
</p>
</xsl:template>
The problem is that no matter what value I use in the 'disable-output-escaping' attribute of the 'value-of', I always get this rendered (as seen in Firefox web developer generated source view):
<p>It may have taken over 12 years
I would like the block of decoded HTML to become encoded when rendering and I was under the impression that this is what the disable-output-escaping would allow.
How do I get this very raw XML to become real HTML again?