'结果文件 sResultsXML = "D:\app\HP\Unified Functional Testing\sample_shikun\reporterLog\Res1\Report\Results.xml" '需要的模版文件 sDetailedXSL = "D:\app\HP\Unified Functional Testing\dat\PDetails.xsl" ApplyXSL sResultsXML,sDetailedXSL,"D:\tt.html" 'tt.html是一个输出文件 SystemUtil.Run "www.baidu.com" Function ApplyXSL(ByVal inputXML,ByVal inputXSL,ByVal outputFile) sXMLLib = "MSXML.DOMDocument" Set xmlDoc = CreateObject(sXMLLib) Set xslDoc = CreateObject(sXMLLib) xmlDoc.async = false xslDoc.async = false xslDoc.load inputXSL xmlDoc.load inputXML outputText = xmlDoc.transformNode(xslDoc.documentElement) outputText = Replace(outputText,"UTF-16","GB2312") Set FSO = CreateObject("Scripting.FileSystemObject") Set outFile = FSO.CreateTextFile(outputFile,true) outFile.Write outputText outFile.Close Set outFile = Nothing Set FSO = Nothing Set xmlDoc = nothing Set xslDoc = nothing Set sResultsXML = nothing End Function
来自:http://blog.csdn.net/zzxxbb112/article/details/5341510