[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: break or exit in xsl?
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? Katharina You can't. In Java or C the looping expressions that you are refering to imply a sequential order of execution, so it makes sense to "stop" and the languages offer that feature. In XSLT there is no such implied ordering, the processor may execute the branches in any order, and in particular it may exectute them in parallel on a suitable machine architecture. If you just want to process every person before the first person who is 30, just select those people, don't select everyone then try to escape later. <xsl:for-each select="Person[Age=30][1]/preceding-sibling::Person"> 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 ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|