IE9中如何解析XML和XSLT,並通過XSLT將XML轉換成HTML?

JollyRoger 发布于 2012/01/06 16:32
阅读 1K+
收藏 0

以下為我在網上找的方法,但是好像是不行的    

 

var xstt = new ActiveXObject("Msxml2.XSLTemplate");  
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");  
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");  
xmlDoc.loadXML(xml);  
xslDoc.loadXML(xslt);  
xstt.stylesheet = xslDoc;  
var xslProc = xstt.createProcessor();  
xslProc.input = xmlDoc;  
xslProc.transform();  
target.html(xslProc.output);  

加载中
0
JollyRoger
JollyRoger
var target = $(this);  
                
                var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0"); 
	           //裝載數據
	            xmlDoc.async = false; 
	            xmlDoc.loadXML(xml);    
		       //裝載樣式
		        var xslDoc = new ActiveXObject("Msxml2.DOMDocument.6.0"); 
		        xslDoc.async = false; 
		        xslDoc.resolveExternals = false; 
		        xslDoc.load(xslt);     		   
    		    
               target.html(xmlDoc.transformNode(xslDoc));  

自己搞定了

http://www.oschina.net/code/snippet_114113_8101

返回顶部
顶部