JS操作XML,按照XSLT逻辑,输出到HTML

 
    
    
function trans(inxml)
{
var stylesheet = new ActiveXObject("MSXML2.DOMDocument");
stylesheet.async = false;
stylesheet.load("XSLTTest.xslt");
var subMenuData = new ActiveXObject("MSXML2.DOMDocument");
var option = document.createElement('H');
for (var i = 0; i<5; i++) {
    var optionA = document.createElement('A');
    optionA.M = "A" + i.toString();
    option.appendChild(optionA);
}
subMenuData.loadXML(option.outerHTML);
var outHtml = subMenuData.transformNode(stylesheet);
return outHtml;
} 


    
    
      
        
            



你可能感兴趣的:(JS,XML/XSLT,xslt,xml,stylesheet,xsl,encoding,div)