Client-side XSLT containing import/include statements does not work in Firefox

"Daniel Frechette" <daniel_@_treknowledge_._com>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization TreKnowledge Inc.
Message-ID <[email protected]>
Hi,

I want to perform XSL transformations in Firefox (v1.0.3) and IE (v6) using 
JavaScript. My problem is with the XSL scripts that contain <xsl:import ...> 
or <xsl:include ...> statements. Firefox stalls indefinitely when it calls 
importStylesheet(...) on a script that contains one or both of these 
statements.  The code works well on IE and I get the expected results, but 
not on Firefox. Does anyone know what I need to do to get this working?


Thank you,
Daniel

Here is my Javascript code:

function buildPage(iXmlStr, iXslStr) {
    ...
    var xmlDoc = getDom(iXmlStr);
    var xslDoc =  getDom(iXslStr);
    html = xslt(xmlDoc, xslDoc);
    ...
};

function getDom(iXmlStr) {
    if (isIE) {
        var xmlDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
        xmlDoc.loadXML(iXmlStr);
        return xmlDoc;
    }
    return (new DOMParser()).parseFromString(iXmlStr, "text/xml");
};

function xslt(iXmlDoc, iXslDoc) {
    var html = null;
    try {
        if (isIE) {
            iXmlDoc.async = false;
            iXmlDoc.resolveExternals = false;
            iXslDoc.async = false;
            iXslDoc.resolveExternals = false;
            html = iXmlDoc.transformNode(iXslDoc);
        }
        else {
            var xsltProc = new XSLTProcessor();
            xsltProc.importStylesheet(iXslDoc);
            var resultDoc = xsltProc.transformToDocument(iXmlDoc);
            var xmlSerial = new XMLSerializer;
            html = xmlSerial.serializeToString(resultDoc);
        }
    } catch (e) {
        // Do something
    }
    return html;
};


Here is a sample XSL file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:import href="http://www.myDomain.com/detailForm.xsl"/>
</xsl:stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.