W3C home > Mailing lists > Public > www-xsl-fo@w3.org > December 2003

Re: xsl: for-each break

From: Oliver Bienert <oliver.bienert@gmx.de>
Date: Fri, 19 Dec 2003 15:46:28 +0100
Message-ID: <3FE30F44.8040705@gmx.de>
To: Marek Hubatka <hubatka@virtual7.de>
Cc: www-xsl-fo@w3.org

I don't think there is something as such as a break in xsl:for-each. 
Instead, you can use a recursive template. You can find a number of 
examples at http://www.jenitennison.com/xslt/

Regards Oliver

Marek Hubatka wrote:
> Hi.
> I have a problem... I need to make a break or something in a xsl: for-each. It has to act like a "while" command in other languages. so it must do a for-each until a condition is not valid any more.
> The sense of this is, that i got a xml file with some "group" nodes in it. one or more group node is in another. i do a xsl:for-each select="descendant::group". in this for-each it looks for a node "record" in the deepest group-node. when it finds a record, it does something and will make a for.each select="ancestor::group" to get the parents. for each parent it tests, if it is the last group of the parent ( xsl:if test = ". = ../group[last()]" ). when it find one group, which is NOT last(), it has to cancel and not process the parents of this node.
> Any ideas?
> MiB
Received on Friday, 19 December 2003 09:46:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:10:00 UTC