xmlfile = "http://myserver/catalog.xml"
xslfile = "catalog.xsl"
' 创建相关对象
Set xslDoc = server.CreateObject("MSXML2.FreeThreadedDOMDocument")
Set xmlDoc = server.CreateObject("MSXML2.DOMDocument")
' 读取xsl文件
xsldoc.async = False
xsldoc.resolveExternals = True
xsldoc.load server.MapPath(xslfile)
' 读取xml文件
xmldoc.setProperty "ServerHTTPRequest",True ' 设置ServerHTTPRequest 属性为 True 为了通过http协议载入xml文档
xmldoc.async = False ' 设置 async属性为 False 关闭异步调用
xmldoc.resolveExternals = True ' 设置 resolveExternals 为 True 打开外部DTD分析
xmldoc.validateOnParse = False ' 设置 validateOnParse 为 False 允许文档验证
xmldoc.load xmlfile ' 读取xml文档
Do While (xmldoc.ReadyState < 4) ' 检查ReadyState状态值是否为4 ' 具体数值定义参见msxml sdk document
xmldoc.waitForResponse 10 ' 通过waitForResponse方法等待文档完全读取完毕 ' 如果为读取完成,系统暂停10毫秒
Loop
' 转换xml -> html 并输出文档
xmldoc.transformNodeToObject xsldoc,Response
' 清空对象
Set xslt = Nothing
Set xsldoc = Nothing
Set xmldoc = Nothing