XSLT command-line option '-m' - 'From Saxon 11.1 this option has no effect.'
The Saxon 12 docs for the XSLT command-line options state that, for the '-m' option: 'From Saxon 11.1 this option has no effect.'
I used to frequently use this option on the command line as follows:
In the Java API Feature Documentation the MESSAGE_EMITTER_CLASS field name is also no longer available.
Note: I've gone back through the different release of Saxon. Saxon version 126.96.36.199 was actually the last versions where this feature worked properly. In Saxon version 188.8.131.52 the following error message is given:
java.lang.IllegalStateException: Emitter must have either a Writer or a StreamResult to write to
Is there equivalent functionality in subsequent Saxon versions or has this feature been dropped?
This is quite important to me as I depend on xsl:message and the default built-in emitter makes more complex text output unreadable.
I'm also investigating colorising the output of xsl:message instructions using ANSI escape sequences - this wouldn't possible with XML escaping
RE: XSLT command-line option '-m' - 'From Saxon 11.1 this option has no effect.' - Added by Michael Kay 8 months ago
The problem with defining callbacks such as the MessageEmitter and ErrorListener at Configuration level is multi-threading - there's no way to tell which of several concurrent transformations generated the message or the error. That's why we dropped it as a configuration option, and I guess the change at the command line was collateral damage. There's also been (for similar reasons) a history of changes to the callback API for messages before we converged on the Saxon 11 design of supplying a
Consumer<Message>, which has the attractive property that it can be implemented by a simple lambda expression.
Instantiating user-supplied classes has always been a bit troublesome but I don't think that's a stopper.
I don't think there's any reason in principle we couldn't reinstate -m on the command line, implementing it by setting a property on the XsltTransformer rather than the configuration.
RE: XSLT command-line option '-m' - 'From Saxon 11.1 this option has no effect.' - Added by Philip Fearon 8 months ago
The lack of a TextEmitter option in the command line interface is no longer critical for me.
For VSCode use, I've coded a simple set of classes (targeting different Saxon versions) extending net.sf.saxon.Transform and overriding newTransformer(). Currently I'm just using setMessageListener but hope to use the MessageHandler API properly at some stage.
Please register to reply