xsl-list
[Top] [All Lists]

Re: break or exit in xsl?

2005-03-07 04:31:52
On Mon, 07 Mar 2005 12:00:52 +0100, Katharina Kreis
<katharinakreis(_at_)web(_dot_)de> 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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>