How do I get the XML string out of the MvpXmlTransform?The sample code provided is this:using System;using System.Xml.XPath;using Mvp.Xml.Common.Xsl;public class ExsltTest { public static void Main() { MvpXslTransform xslt = new MvpXslTransform(); xslt.Load("foo.xsl"); xslt.Transform(new XmlInput("foo.xml"), new XmlOutput("result.html")); } }But instead of outputting the XML to a file I want to do some in-memory string processing on it. But I haven't found a way of getting to it.n.b. I want to handle it as a string, not as an XML document.Is there some XmlOutput class that wraps a string variable? Or is there some XmlReader class that does the same?
You need StringWriter class:
MvpXslTransform
xslt.Load("../../style.xsl");
StringWriter sw = new StringWriter();
xslt.Transform(new XmlInput("../../source.xml"), null, new XmlOutput(sw));
sw.Close();
string result = sw.ToString();
Console.WriteLine(result);