C# 处理XML + XSLT转换中HTML元素的输出问题及解决

            XslTransform xslt = new XslTransform();
            XmlDocument xml 
= new XmlDocument();
            xslt.Load(
"a.xslt");
            xml.Load((
"a.xml"));
            
using (XmlTextWriter writer = new XmlTextWriter("a.doc", Encoding.Default))
            
{
                xslt.Transform(xml, 
null, writer, null);
                writer.Close();
            }


将上述 C# 代码中的 XmlTextWriter 换成 FileStream 一切搞定。

System.IO.Stream strmTemp = new System.IO.FileStream("a.doc", System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);

 也可以用System.Web.UI.HtmlTextWriter替代XmlTextWriter

原文地址:https://www.cnblogs.com/flyfish/p/310007.html