实时给XML文档加载XSL需要在程序中创建四个对象,我们用Javascript 作为开发语言来谈谈对这四个对象的使用,其中用于创建XSL文件和XML文件的访问对象需要使用多线程。
//创建XSL文件的多线程DOM对象
var xslDoc=new ActiveXObject("Msxml2.freethreaderDomdocument.4.0");
xslDoc.async=false;
xslDoc.load("product.xsl");
//创建缓存模版对象
var xslt=new ActiveXObject("Msxml2.XSLTemplate.4.0");
xslt.stylesheet=xslDoc;
//把XSL文件和模版文件进行关联
//创建XML文件的多线程DOM对象
var xmlDoc=new ActiveXObject("Msxml2.freethreadedDomdocument.4.0");
xmlDoc.async=false;
xmlDoc.load("Product.xml");
//创建XSL处理对象
xslProc=xslt.createProcessor();
xslProc.input=xmlDoc;
xslProc.transform();
alert(xslProc.output);
发表于 @ 2006年09月18日 14:27:00 | 评论( loading... ) | 举报| 收藏