RE: How Can You Exit an xsl:for-each Loop Prematurely?

Subject: RE: How Can You Exit an xsl:for-each Loop Prematurely?
From: Michael Teigman <michael.teigman@xxxxxxxxxxx>
Date: Thu, 23 Sep 1999 12:58:43 -0400
My source XML has an element with a set of attributes with the same name e.g.,

<Salesman>
     <Orders Order=""/>
     <Orders Order=""/>
     <Orders Order="zzzzzzzzz"/>
     <Orders Order="ee"/>
</Salesman>

To simplify, I am doing the equivalent of trying to find the first non-null
Order, e.g.:

<xsl:for-each select="//Salesman/Orders/@Order">
     <xsl:variable name="orderID">
                    <xsl:value-of select="."/>
     </xsl:variable>
     <xsl:if test="string-length($orderID) > 0">
          ..... output something .....
     </xsl:if>
</xsl:for-each>

I want only the first output. I do not want multiple outputs.

How could I exit after the first or suppress the additional outputs after I have
found one?

     mike



                                                                  
 (Embedded                                                        
 image moved   "Harbarth, Juliane" <jhb@xxxxxxxxxxxxxx>           
 to file:      09/23/99 10:43 AM                                  
 pic06086.pcx)                                                    
                                                                  



Please respond to xsl-list@xxxxxxxxxxxxxxxx

To:   xsl-list@xxxxxxxxxxxxxxxx
cc:    (bcc: Michael Teigman/HPG/US/Reuters)
Subject:  RE: How Can You Exit an xsl:for-each Loop Prematurely?







> From: Michael Teigman [mailto:michael.teigman@xxxxxxxxxxx]
> Sent: Thursday, September 23, 1999 1:31 AM
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: How Can You Exit an xsl:for-each Loop Prematurely?
>
> Is there some way to exit an xsl:for-each loop before all the nodes have
been
> evaluated?

I can't think of anything to achieve that.
Can you give some more details of what you are trying to do ?

Juliane.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


------------------------------------------------------------------------
Any views expressed in this message are those of the individual  sender,
except  where  the  sender  specifically  states them to be the views of
Reuters Ltd.

Attachment: pic06086.pcx
Description: Binary data

Current Thread