Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xsl:include not working from a Firefox extension

100 views
Skip to first unread message

Adrià

unread,
Jan 15, 2010, 10:38:21 AM1/15/10
to
Hi everyone,
I am developing a Firefox extension that uses XSL transformations. I
have been using XSLTProcessor without problems until I needed to do an
xsl:include from the XSL stylesheet. When I import the XSL stylesheet
that uses an xsl:include, Firefox gives an error:

Error: Component returned failure code: 0x80600001
[nsIXSLTProcessor.importStylesheet] = <unknown>
Source file: chrome://myextension/content/functions.js
Line: 632

This only happens when running the code from the Firefox extension, if
I run it in "normal" html page the code works perfectly. I also tried
with xsl:import and got the same result.

Does anyone know what could I be doing wrong?
Thanks in advance


Here is the code to reproduce it:

File functions.js:

function testXSL(){
var processor = new XSLTProcessor();

var xsl = document.implementation.createDocument("", "test", null);
xsl.addEventListener("load", onXSLLoaded, false);

xsl.load("test1.xsl");

function onXSLLoaded() {

processor.importStylesheet(xsl);

}

}

File test1.xsl:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink">

<xsl:include href="test2.xsl" />

</xsl:stylesheet>


File test2.xsl:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink">

<xsl:template match="/">
<h1>Included!!</h1>
</xsl:template>

</xsl:stylesheet>

0 new messages