Re: [xsl] How to report errors to stdout from xslt?

Subject: Re: [xsl] How to report errors to stdout from xslt?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Jul 2004 09:19:16 -0400
At 2004-07-25 08:51 -0400, Don McClimans wrote:
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.


to stdout,

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.

.................... Ken

--
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

Current Thread