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

Re: Break the For-each loop

Subject: Re: Break the For-each loop
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 9 Sep 2005 10:51:13 +0100
break for loop
> So how do I break the loop after I have
> found the first apple?

You never break out of a for loop in xslt. It is best to assume that you
are using a massively parallel machine and all items in the loop are
executed _in parallel_ and assembled into the final output in a
specified order which might be totally unrelated to the order in which
they are evaluated. (Even if in fact you are on a sequential machine an
XSLT compiler may (and some do) execute the items in orders which don't
correspond to the natural order that you might expect.

So don't break the loop: just select the items that you want to process,
for example if you want to process all the children up to and including
the first apple do

<xsl:for-each select="apple[1]/preceding-sibling::*|apple[1]">

David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.