I'm using Xalan 2.1.0.
Is there a way to override the xsl:output method declared in the stylesheet?
In particular, is it possible to avoid the default HTML serialization of
result trees that have an "html" root element? I found that even if I
explicitly call setOutputProperty(OutputKeys.METHOD, "xml"), my request is
disregarded if the resulting root element ends up being "html".
My assessment is as follows:
1. setOutputProperties overrides xsl:output (per JAXP documentation)
2. Xalan's automatic HTML-detection overrides setOutputProperties (!)
3. but HTML-detection does *not* override xsl:output (per XSLT spec)
Is this assessment correct?
Effectively, this means that the only place I can have true control over the
serialization method is with xsl:output. I need control from the API.
One of the nice things about TransformerFactory.newTransformer() is that it
provides a simple way to serialize documents (simply copying Source to
Result). If I have no way of ensuring that well-formed XML will be
serialized, I can no longer use this as a general purpose serializer.
Finally, is there a way to determine (perhaps not through JAXP) what a
particular output property is for a transformation before it's serialized?
This implies breaking the atomicity of Transformer.transform(). The reason
for this is that in certain cases I might want to go with the default output
method and still somehow know how I should call, for example,
ServletHttpResponse.setContentType(...)
Any help on these issues would be greatly appreciated.
Evan Lenz
XYZFind Corp.