seconding request for xsl:exit instruction

Dear editors,

In Robert C. Lyons message entitled "XSLT wish list" (20 May 1999), he
included a request for an xsl:exit instruction:

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

Since there was no response in the archives, I wrote to Bob, who told me
that he received a response to part of his message, but not this part.

I would like to second Bob's request for including this instruction in a
future version of XSLT, though my intended purpose is different. 
Specifically, I'm interested in using XSLT to perform tree-matching, and
would like to use xsl:exit to return just the first match, as
illustrated in the attached file.  Currently this can be done by using a
boolean variable ($done, say) as a flag, plus a ton of xsl:if blocks,
but this workaround is not pretty.

Regards, -Mike

Received on Monday, 4 October 1999 15:45:52 UTC