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