[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: appending to result-document

Subject: RE: appending to result-document
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 3 Aug 2005 10:01:00 +0100
RE:  appending to result-document
> I have used xsl:message several times to debug my files or test 
> intermediary output. But I wasnt aware that I could actually 
> store these 
> messages in some file. Could you either tell me how to do it 
> or point me 
> to some web page where I can read some more ?

The simplest answer is to redirect standard error output from the command
line, using

   2>messages.xml

However, this will divert all error output, including real error messages,
warnings, etc. A better solution is to redirect the message output
selectively. You can do this from Java but not from the command line.

You probably have to dive into the Saxon Javadoc for documentation.

If you use JAXP with Saxon, you can cast the Transformer object to a
net.sf.saxon.Controller. 

http://www.saxonica.com/documentation/javadoc/net/sf/saxon/Controller.html 

The Controller has a method setMessageEmitter() which you can use to capture
all xsl:message output if you want to go that far. More simply, you can call
getMessageEmitter() which will return a net.sf.saxon.event.MessageEmitter

http://www.saxonica.com/documentation/javadoc/net/sf/saxon/event/MessageEmit
ter.html

which has a setWriter() method that you can use to set the output
destination to a Writer of your own choosing (or perhaps more simply, a
setStreamResult() method.)

(Note, recent versions of JAXP specify that message output should be sent to
the ErrorListener, which I believe is the Xalan convention. Saxon doesn't
follow this convention. In general, the content of an xsl:message is XML
rather than merely text, and the ErrorListener is only able to handle text.
The MessageEmitter receives the message as XML, in event form.)

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.