I started working with Saxon-B (18.104.22.168) 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);
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());
So I took the OutputSettings from the XslCompiledTransform.
How can I do this with Saxon?
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.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.