0

このコードで型の不一致エラーが発生しました:

function xsltTransform(xmlPath, xslPath, parameter) {
    if (lastXMLloaded != xmlPath) {
        xml = loadXMLDoc(xmlPath);
        lastXMLloaded = xmlPath;
    }
    if (lastXSLloaded != xslPath) {
        xsl = loadXSLDoc(xslPath);
        lastXSLloaded = xslPath;
    }
    var param = parameter.split(";");
    var count = param.length;
    if (window.ActiveXObject) {
        var template = new ActiveXObject("MSXML2.XSLTemplate");
        template.stylesheet = xsl.documentElement;
        var xsltProcessor = template.createProcessor();
        xsltProcessor.input = xml;
        for (i = 0; i <= count - 1; i++) {
            var paramKeyValue = param[i].split(",");
            xsltProcessor.addParameter(paramKeyValue[0], paramKeyValue[1]);
        }
        xsltProcessor.transform();
        var result = xsltProcessor.output;
        return result;
    } else if (document.implementation && document.implementation.createDocument) {
        xsltProcessor = new XSLTProcessor();
        try {
            xsltProcessor.importStylesheet(xsl);
        } catch (e) {}
        for (i = 0; i <= count - 1; i++) {
            var paramKeyValue = param[i].split(",");
            xsltProcessor.setParameter(null, paramKeyValue[0], paramKeyValue[1]);
        }
        var resultDocument = xsltProcessor.transformToFragment(xml, document);
        return resultDocument
    }
}

コードのこの部分:template.stylesheet = xsl.documentElement;は、値が であることを示していますnull

4

0 に答える 0