This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Jumping out a loop
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl]Jumping out a loop
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 18 Apr 2001 13:19:45 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> I have the following loop:
>
> <xsl:for-each select="Grasslands/*[position()>3 and text()]">
> <h3><font color="#00007f"><i><xsl:value-of
> select="name()"/></i></font></h3>
> <p><font color="#008000"><xsl:value-of select="."/></font></p>
> </xsl:for-each>
>
> I want to jump out the loop
It helps to think about these problems if you understand the processing
model. <xsl:for-each> isn't a loop: it's a function mapping. It says that in
the output you want one Y for every X that appears in the input. Since it's
not a loop, jumping out of it doesn't make sense. What you need is a
different function.
I can't answer your problem without understanding your requirement better,
but it looks to me as if you want two <xsl:for-each> instructions:
<xsl:for-each select="one set of nodes">...</xsl:for-each>
<xsl:for-each select="another set of nodes">...</xsl:for-each>
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list