I'm getting an "Illegal character in path" exception when I call the Transform method of the XslCompiledTransform class.
Here is my code :
// Maybe there is a problem in this path
string xsltPath = @"..\..\HtmlAttributesParser.xslt";
XslCompiledTransform xsltCompiled = new XslCompiledTransform();
xsltCompiled.Load(xsltPath, new XsltSettings(false, true), new XmlUrlResolver());
StringBuilder output = new StringBuilder();
xsltCompiled.Transform(content, XmlWriter.Create(output));
There isn't any * ? " < > | in my path so I wonder why I get this Exception.
Regarding to the Exception message, there is no connection between the value of my content var and this exception right ?
Edit : Here is the content which works on an online XSLT tester
<div class="pk-link">
<a href="/STORE/Pages/myPage.aspx" url="/STORE/Pages/myPage.aspx" width="" heigth="" target="_blank">
<img border="0" src="/link_download.gif"/>
Download
</a>
</div>
If you have a string with XML input then you need to use an overload of the
Transform
method expecting anXmlReader
orXPathDocument
(or more generallyIXPathNavigable
) created over that string so do e.g.The overloads of the Transform method that take a string as the first argument expect a file path or URL, not the XML input.