Exception during importStylesheet()
Marco Baumgartl <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I try to play around a little bit with XSLT functionality of Firefox.
Unfortunately it is not working for me right from the start :-(
I get the following exception if I try to import the style sheet:
[Exception... "Component returned failure code: 0x80600001
[nsIXSLTProcessor.importStylesheet]" nsresult: "0x80600001 ()" location:
"JS frame :: http://localhost/~marco/test/xml/ :: onStylesheetLoad ::
line 20" data: no]
Here is what I'm doing:
<html>
<head>
<title>XSLT/Javascript</title>
<script type="text/javascript">
var processor = null;
var xsltDoc = null;
function load() {
if (document.implementation && document.implementation.createDocument) {
processor = new XSLTProcessor();
xsltDoc = document.implementation.createDocument("", "", null);
xsltDoc.async = null;
xsltDoc.addEventListener("load", onStylesheetLoad, false);
}
xsltDoc.load("transform.xsl");
}
function onStylesheetLoad() {
try {
processor.importStylesheet(xsltDoc);
} catch (e) {
alert("Exception caught: " + e);
}
}
</script>
</head>
<body onLoad="load()">
</body>
</html>
I added the onStylesheetLoad function because I thought the exception
was thrown due to the fact that the stylesheet was not loaded completly.
But this was not the solution.
Here is my style sheet:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<div>
<xsl:apply-templates />
</div>
</xsl:template>
</xsl:transform>
The style sheet gets loaded because an
alert(xsltDoc.childNodes[0].nodeName);
in onStylesheetLoad shows me "xsl:transform" as first node.
The exception is thrown using Debian's (unstable) Firefox 1.5.0.3 as
well as Firefox 1.5.0.4 on a Windows 2000 operating system.
Can you give me a hint, please?
regards,
Marco