Quantcast

xsl:include not working from a Firefox extension

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

xsl:include not working from a Firefox extension

Adrià-6
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>
_______________________________________________
dev-tech-xslt mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xslt
Loading...