try
{
string sourceDoc = "resource-sample.xml";
string xsltDoc = "resource.xslt";
XPathDocument myXPathDocument = new XPathDocument(sourceDoc);
XslCompiledTransform myXslTransform = new XslCompiledTransform();
MemoryStream ms = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(ms, null);
myXslTransform.Load(xsltDoc);
myXslTransform.Transform(myXPathDocument, null, writer);
ms.Seek(0, SeekOrigin.Begin);
StreamReader stream = new StreamReader(ms);
this.txtOutput.Text = stream.ReadToEnd();
writer.Close();
}
catch (FileNotFoundException filexc)
{
MessageBox.Show("File Not Found!", "File Not Found Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
/*************xml********************/
/************xslt********************/