c#将qtp结果(xml+xsl文档)转换为html格式

根据QTP的XML结果和在安装目录dat下的xsl文件,把结果转换为HTML格式。

1
2
3
4
5
6
7
8
9
public static void ()  
{
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(sPShortXSL);
XPathDocument xml = new XPathDocument(sResultXML); // Result xml file
XmlTextWriter writer = new XmlTextWriter(sPShortHTML, Encoding.GetEncoding("GB2312")); // Encode to GB2312 for display Chinese
xsl.Transform(xml, writer); // Complement transfor
writer.Close();
}