XSLT在IE中添加参数?

时间:2012-02-29 17:24:26

标签: javascript html xml xslt

这是来自W3网站的代码,只需稍加修改即可设置参数,但它目前仅适用于FF,Opera等。每当有人从下拉列表中选择内容时,我需要调用Transform函数,发送一个参数并显示不同的东西。如何修改代码以在IE中设置参数?

function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
 xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}

function Transform()
{
xml=loadXMLDoc("cdcatalog.xml");
xsl=loadXMLDoc("cdcatalog.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.setParameter(null, "derp", derp);
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}

1 个答案:

答案 0 :(得分:0)