在Internet Explorer中使用XSLT转换XML
我需要JavaScript脚本来通过XSLT表格解析XML文件到XHTML代码。我的代码与Firefox,Opera和Safari兼容。
function loadXMLFile(path) {
var file = document.implementation.createDocument("", "", null);
file.async = false;
file.load(path);
return file;
}
function parseXMLFile() {
var xml = loadXMLFile("data.xml");
var xsl = loadXMLFile("data.xsl");
var xslt = new XSLTProcessor();
xslt.importStylesheet(xsl);
var xhtml = xslt.transformToFragment(xml, document);
document.firstChild.replaceChild(xhtml, document.firstChild);
}
parseXMLFile();
它是Internet Explorer和Chrome的无效代码。我知道IE的Microsfot.XMLDOM库,但我不知道如何使用它。如何为IE和可选的Chrome编写好的代码?
没有找到相关结果
已邀请:
2 个回复
完趣镐
我在博客上写了一篇关于它的文章
凰葱崎济邯