Skip to content

Instantly share code, notes, and snippets.

@ahall
Created November 1, 2010 22:43
Show Gist options
  • Save ahall/659011 to your computer and use it in GitHub Desktop.
Save ahall/659011 to your computer and use it in GitHub Desktop.
TransformXslt.cs
public static void Transform(Stream xmlDoc, string sXslPath, Stream outStream)
{
//load the Xml doc
XPathDocument myXPathDoc = new XPathDocument(xmlDoc);
XslTransform myXslTrans = new XslTransform();
//load the Xsl
myXslTrans.Load(sXslPath) ;
//create the output stream
using (XmlTextWriter myWriter = new XmlTextWriter(outStream, null))
{
//do the actual transform of Xml
myXslTrans.Transform(myXPathDoc,null, myWriter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment