You can't do this very easily using the Saxon .NET API, but I think you can discover the output properties of the stylesheet if you dig deep enough: the Implementation property of the XsltTransformer gives you a net.sf.saxon.Controller, and this has a method getOutputProperties which returns a Properties object whose getProperty() method will return the relevant property.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I started working with Saxon-B (9.1.0.5) and try to migrate my code that used the System.Xml namespace in .NET.
Now I've a problem when transforming with a xslt that has the xsl:out method="text":
I use a TextWriterDestination with a XmlWriter:
XmlWriter xmlWriter = XmlWriter.Create(filename);
XmlDestination serializer = new TextWriterDestination(xmlWriter);
...
loadedXslt.Run(serializer);
The last line gives the error, that the resulting document would not result in a well formed Xml (of course, it's a plain text).
In old code I initialized the XmlWriter this way:
xsltTransformer = new XslCompiledTransform(false);
XsltSettings settings = new XsltSettings(true, true);
xsltTransformer.Load(xsltStream, settings, new XmlUrlResolver());
XmlWriter.Create(filename, xsltTransformer.OutputSettings);
So I took the OutputSettings from the XslCompiledTransform.
How can I do this with Saxon?
Thanks
Thank you. That helped me a lot. And it was rather easy to get the information and transfer it to a Setting-object.
You can't do this very easily using the Saxon .NET API, but I think you can discover the output properties of the stylesheet if you dig deep enough: the Implementation property of the XsltTransformer gives you a net.sf.saxon.Controller, and this has a method getOutputProperties which returns a Properties object whose getProperty() method will return the relevant property.