Re: How to get xsl:output/@method after transformation?
John Ulric <[email protected]> Fri, 30 Apr 2021 20:53:12 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CANS5RicL6HoHSsXNARSqF+rDjvOTy6VLfOKR7cOxmV8aVcrB9w@mail.gmail.com> |
Thank you all for your answers. For what I'm trying to do, this simple one
does the job:
xsltExecutable.getUnderlyingCompiledStylesheet().getPrimarySerializationProperties().getProperty("method")
The generic approach would be better, so I've also tried overriding
Serializer like this:
class OutputMethodInterceptingSerializer extends Serializer {
String method;
OutputMethodInterceptingSerializer(final Processor processor,
final OutputStream stream) {
super(processor);
this.setOutputStream(stream);
}
@Override
public Receiver getReceiver(final PipelineConfiguration pipe,
final SerializationProperties params) throws SaxonApiException {
method = params.getProperty("method");
return super.getReceiver(pipe, params);
}
String getMethod() {
return method;
}
}
This, however, does not work for me: After the transformation, .getMethod()
returns "html" for a stylesheet with an explicit <xsl:output method="html"/>.
But for a stylesheet with no xsl:output element and (correct)
auto-detection of html serialization, .getMethod() returns null.
.getReceiver() gets called once both times, params is empty when
auto-detection is in effect.
Any ideas?
John
>
>
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help