If you ever wanted to take XML as string in memory, transform it, and out the results as a string:
private
bool verifyTransformation(string xml, string xslPath)
{
//create an XPathDocument using the reader containing the XML
MemoryStream m = new MemoryStream(System.Text.Encoding.Default.GetBytes(xml));
XPathDocument xpathDoc = new XPathDocument(new StreamReader(m));
//Create the new transform object
XslCompiledTransform transform = new XslCompiledTransform();
//String to store the resulting transformed XML
StringBuilder resultString = new StringBuilder();
XmlWriter writer = XmlWriter.Create(resultString);
transform.Load(xslPath);
transform.Transform(xpathDoc,writer);
}
Now you can access the results by using the ToString() method of the StringBuilder.