I am using C# code in aspx pages to covert the infopath xml pages into html. Here is my code:
XPathDocument myDoc = new XPathDocument(@"C:\Users\rameshgandhik\Documents\infopath forms\ram.xml");
XmlTextWriter myWr = new XmlTextWriter(@"C:\Users\rameshgandhik\Documents\infopath forms\ram.html",null);
XslTransform myXsl = new XslTransform();
myXsl.Transform(myDoc, null, myWr); // Here i am getting an error.
At myWr in Transform method it is showing an error that "No stylesheet was loaded.".
Can any have the idea about this error......... Please tell me the solution....
That would be because you haven't loaded the stylesheet. :-)
You've created a new XslTransform
object, but you didn't actually put any transformation rules into it. Therefore, it doesn't know how to transform the XML you're giving it, which is pretty clearly expressed in the error message.
If you want to take the transform from an *.xsl
file, you can use the XslTransform.Load
method.
If you want to get the transform from some other location, please specify what that location is, and I would probably be able to help you.