OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] is there a way to break out of the xsl:for-each loop ?

[ Lists Home | Date Index | Thread Index ]

You seem to be assuming that the elements are processed serially, starting
with the first. Such an assumption is invalid.

Write

<xsl:for-each select="$list-of-nodes[string(.)=$mySearchItem][1]">

Michael Kay 

# -----Original Message-----
# From: Bill Riegel [mailto:BRiegel@lgc.com] 
# Sent: 23 March 2004 14:38
# To: 'xml-dev@lists.xml.org'
# Subject: [xml-dev] is there a way to break out of the 
# xsl:for-each loop ? 
# 
# 
# What to look thru a listOfNodes, and set contents on a 
# variable, foundIt, when I found what I am looking for, then break. 
# 
# <xsl:variable name="foundIt">
# 	<xsl:for-each select="$listofNodes">
# 		<xsl:if test="string(current()) = $mySearchItem">
# 			<!-- break out of look if found what I 
# am looking for -->
# 			<xsl:break>  
# 		</xsl:if>
# 	</xsl:for-each>
# </xsl:variable>
# 
# <!-- do something with foundIt -->
# 
# Bill Riegel
# LandMark Graphics
# 713-839-3388
# 
# 
# 
# -----------------------------------------------------------------
# The xml-dev list is sponsored by XML.org 
# <http://www.xml.org>, an initiative of OASIS 
# <http://www.oasis-open.org>
# 
# The list archives are at http://lists.xml.org/archives/xml-dev/
# 
# To subscribe or unsubscribe from this list use the subscription
# manager: <http://www.oasis-open.org/mlmanage/index.php>
# 
# 





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS