建站学院(LieHuo.Net)XML文档 先来看一段代码:
以下为引用的内容: var doc = null; var sdoc = null; try { doc = new ActiveXObject("MSXML2.DOMDocument.6.0"); sdoc = new ActiveXObject("MSXML2.DOMDocument.6.0"); } catch(e) { alert(e.toString()); } if(doc) document.write("ok"); else document.write("fail"); doc.async = false; doc.load("http://localhost/xml/a.xml"); sdoc.async = false; var r = sdoc.load("http://localhost/xml/a.xsl"); try { //var result = doc.transformNode(sdoc.documentElement); sdoc.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); var tmp = sdoc.documentElement.selectSingleNode("xsl:template[@mode='b']"); alert(tmp.xml); var result = doc.transformNode(sdoc); alert(result); //document.write(result); } catch(e) { alert(e.toString()); } |