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

Re: break or exit in xsl?

Subject: Re: break or exit in xsl?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 7 Mar 2005 22:31:52 +1100
xsl if exit
On Mon, 07 Mar 2005 12:00:52 +0100, Katharina Kreis
<katharinakreis@xxxxxx> wrote:
> Hi!
> 
> I need to exit my xsl:for-each tag when I'm reaching a value. Example:
> 
> <xsl:for-each select="Person/Age">
>    <xsl:if test=".='30'>
>       ...
>       <!-- Here I need to exit xsl:for-each -->
>    </xsl:if>
> </xsl:for-each>
> ...
> 
> In Java or C++ there exists a break or exit keyword to do this. How can
> I do this with xsl?

This effect can be achieved using *not* an xsl:for-each instruction,
but a template (or xsl:function), which, if the "stop-function"
doesn't evaluate to true on the first item of a given sequence,
processes this first item and then calls itself recursively to process
the tail of the list/sequence.

Cheers,
Dimitre Novatchev.

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.