Can one write the results of a XSLTransform.Transform to a memorystream instead of a XMLTextWriter object?
I need to be able to send the results of my transform over the wire to a webbrowser, so writing it to a file on disk on the server is no good.
Tony
另一个选择是使用较新的XslCompiledTransform ,它具有重载以输出到Stream。
You can easily hook an XmlTextWriter up to a StringWriter, and then send the resulting string to the browser:
StringWriter stringWriter = new StringWriter();
XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
// write your transform to xmlTextWriter...
xmlTextWriter.Flush();
xmlTextWriter.Close();
stringWriter.Flush();
string result = stringWriter.ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.