- From: Robert C. Lyons <boblyons@unidex.com>
- Date: Thu, 20 May 1999 21:34:55 -0400
- To: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
I'm writing an XSLT stylesheet that must validate some of the
fields in the source document while transforming the
source document into a new XML document. When my XSLT stylesheet
finds a validation error, I would like it to do the following:
- Write an error message to standard error (rather than to the result tree).
The error message should include the line number within the source
document of the invalid data.
- Abort the processing of the stylesheet and specify the exit code
that the XSLT processor will return.
I'm hoping that a future version of XSLT will let me use
the xsl:message instruction to write an error message
to standard error.
It would also be nice if XSLT provided a function that returned
the line number for a node in the source document.
Lastly, I'd like to see an "xsl:exit" instruction added to XSLT.
For example:
<xsl:if test="not(element='valid_value')">
<xsl:message>Error: element contains invalid value</xsl:message>
<!-- Abort stylesheet and cause the XSLT processor to exit with
an exit code of 2. -->
<xsl:exit code="2"/>
</xsl:if>
With the current version of XSLT, the stylesheet can abort
processing by invoking an illegal instruction (e.g., xsl:abort-stylesheet).
For example:
<xsl:if test="not(element='valid_value')">
<xsl:message>Error: element contains invalid value</xsl:message>
<!-- Abort stylesheet by invoking an illegal instruction. -->
<xsl:abort-stylesheet/>
</xsl:if>
However, this is a little kludgey and it doesn't allow you specify an exit code.
Also, there may be cases where you want the stylesheet to force an early,
successful exit.
Thanks.
Bob
------
Bob Lyons
EC Consultant
Unidex Inc.
1-732-975-9877
boblyons@unidex.com
http://www.unidex.com/
Received on Thursday, 20 May 1999 21:32:03 UTC