Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XslTransform.Load problem

Status
Not open for further replies.

dyarwood

Programmer
Nov 3, 2003
1,483
GB
I am trying to open an XSL file on via the following code

try
{
string XSLT = "c:\\sytlesheet.xsl";
string strXML = "c:\\xmlsourcefile.xml";
StringBuilder sb = new StringBuilder();
TextWriter tw = File.CreateText("c:\\OUTPUTFILE.txt");
new StringWriter(sb);
XslTransform xslt = new XslTransform();
xslt.Load(XSLT);
XPathDocument xp = new XPathDocument(strXML);
xslt.Transform(xp,null,tw);
return sb.ToString();
}
catch(Exception e)
{
throw e;
}

The code always fails on the xslt.Load(XSLT) line with the error

An unhandled exception of type 'System.Xml.Xsl.XsltCompileException' occurred in ...

This is a windows app if that makes a difference.

Does anyone have any ideas why the code might not be working? Any help would be much appriciated.
 
Nevermind. That code does work its the XSL file which is a bit wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top