为了生成 HTML 报告,我试图在下面执行代码。该脚本在“xmlSource.transformNode(xmlXForm)”处引发错误。错误显示“样式表不包含文档元素”。
请帮忙。
Function ConvertToHTML(sResultPath)
'sResultPath = "C:\DOCUME~1\user\LOCALS~1\Temp\TempResults\"
sProductDir = "C:\Program Files\HP\QuickTest Professional\dat\"
strOldText = "UTF-16"
strNewText = "UTF-8"
Const ForWriting = 2
Set xmlSource = CreateObject("MSXML.DOMDocument")
Set xmlXForm = CreateObject("MSXML.DOMDocument")
xmlSource.validateOnParse = True
xmlXForm.validateOnParse = True
xmlSource.async = False
xmlXForm.async = False
xmlSource.Load sResultPath & "Report\Results.xml"
xmlXForm.Load sProductDir & "PShort.xsl" 'if you want more details, then you can use PDetails.xsl
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set fso = CreateObject("Scripting.FileSystemObject")
sHTMLPath = Replace(sResultPath & "Report\Results.xml", ".xml", ".html")
Set file = fso.OpenTextFile(sHTMLPath, ForWriting, True)
file.write xmlSource.transformNode(xmlXForm)
file.Close
fso.CopyFile sProductDir & "PResults.css", sResultPath & "Report\"
Set file = Nothing
Set fso = Nothing
Set xmlXForm = Nothing
Set xmlSource = Nothing
End Function
Call ConvertToHTML("H:\GB_Automation\Res1\")
谢谢巴维亚