Re: How to report errors to stdout from xslt?
What I would like to do in my xslt script is generate an error message
Such communication from the stylesheet to the operator is done using <xsl:message> optionally with a terminate="yes" attribute to halt processing.
Where the message goes is up to the processor, there is no control from the stylesheet.
and then return an error code from the xslt processor,
The error code returned us up to the processor, there is no control from the stylesheet.
When using terminate="yes" the end XML result is undefined, but given you are producing text files and not XML files, you cannot rely on downstream processes choking on the input file not being well-formed. Hopefully the processor you choose will return a non-zero result in such a case.
Check your choice of processors for their handling of <xsl:message> to get the kind of facilities you can trigger on ... all I've been able to rely on is a non-zero result with terminate="yes" ... that allows one to use <xsl:message> for non-fatal error reporting and still get an error return of zero.
I hope this helps.
-- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format