内容 |
xml转换成html文件方法 /// < summary> ///将xml转化为html /// < /summary> /// < param name="xmlpath">xml文件路径< /param> /// < param name="xslfilepath">xslt文件路径< /param> /// < param name="htmlfilepath">声称的html文件路径< /param> public static void xmltranstohtml(string xmlpath, string xslfilepath, string htmlfilepath) { //生成html文件路径 string htmlfilepath = htmlfilepath; xpathdocument myxpathdoc = new xpathdocument(xmlpath); xslcompiledtransform myxsltrans = new xslcompiledtransform(); //加载xsl文件 myxsltrans.load(xslfilepath); xmltextwriter mywriter = new xmltextwriter(htmlfilepath, system.text.encoding.default); myxsltrans.transform(myxpathdoc, null, mywriter); mywriter.close(); } |