Hi all,
I'm having a real problem with getting an XMLWriter as a result of an
xsl tranform I'm attempting.
My code is:
private void btnPerformTransform_Click(object sender, EventArgs e) {
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
XmlWriter xmlWriter = new XmlTextWriter(new StringWriter());
xslt.Load("FlightsAvail.xsl");
xslt.Transform("testXMLIn.xml", xmlWriter);
Console.Out.Write("");
}
This code is returning the following exception:
Execution of the 'document()' function was prohibited. Use the
XsltSettings.EnableDocumentFunction property to enable it.
I've tried numerous alternatives to get this to work and I'm frustrated
because I know its going to be really simple.
One thing I'd point out though, is that it doesn't really matter what
object form the output of the transform comes as - as long as I can then
load it into an XMLDocument instance without having to write the output
of the transform to a file first.
I've been trying all sorts of things with memory streams and what not,
but I keep coming up against exceptions. As you can maybe tell, I don't
do IO stuff very often.
If anyone has any code that can get me an xmlwriter or something similar
containing the results of an xsl transform I would be really grateful.
Many thanks in advance
Kindest Regards
Simon