XSL file load
"Seamus" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
I am having issues loading an XSL file into my script (on FireFox). The
stylesheet is below. I am trying to load via the syntax below. If I try to
load via the loadXML extension that I wrote, all works well. If I try to
load from the file...I get nothing in the resulting document. I am doing
the child node copy for the string input and have tried to implement the
same DOM node magic for the file input but with no luck. Any ideas?
var xslDoc = document.implementation.createDocument("", "",
null);
// xslDoc.async = false;
// xslDoc.loadXML(xslStr);
xslDoc.load(xslSource);
xslDoc.addEventListener("load", _Document_onload_XSLT(xslDoc),
false);
WHERE:
xslSource = some rel path to an XSLT file(below)
AND:
function _Document_onload_XSLT(xslDoc) {
processor.importStylesheet(newDoc);
//change the readyState
changeReadyState(this, 4);
}
-------------------
stylesheet.xslt
---------------------
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="/rootnode">
<html>
<head>
<title>Test</title>
</head>
<body>
<h2>TEST</h2>
<xsl:apply-templates select="//alert" />
</body>
</html>
</xsl:template>
<xsl:template match="alert">
<div class="alert">
<xsl:value-of select="title"/>
<xsl:value-of select="timestamp"/>
</div>
</xsl:template>
</xsl:stylesheet>