Capture <xsl:message/> output
Added by Anonymous almost 16 years ago
Legacy ID: #7322518 Legacy Poster: Ivan Latysh (ivanlatysh)
Hello Michael ! I am invoking XSLT transformation from the Java code. And I would like to capture all <xsl:message/> output. Where should I register my own output stream to capture that ? Thank you.
Replies (1)
RE: Capture <xsl:message/> output - Added by Anonymous almost 16 years ago
Legacy ID: #7322686 Legacy Poster: Michael Kay (mhkay)
If you're using s9api, there's a high-level interface for this: XsltTransformer.setMessageListener(), where MessageListener is then notified of each message in the form of an XML node (in general, xsl:message outputs XML, not just text). Or you can use lower-level interfaces. If you merely want to redirect the message output to a different stream, you can do ((Emitter)controller.getMessageEmitter()).setOutputStream(stream) where controller is the JAXP Transformer cast to net.sf.saxon.Controller. If you also want to reformat the message output, you can capture it at the XML event level using controller.setMessageEmitter().
Please register to reply