This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: AW: For loop
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: AW: [xsl] For loop
- From: Bedwell Tom <Tom dot Bedwell at icl dot com>
- Date: Thu, 12 Jul 2001 14:12:50 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
You're trying to make XSLT work like a procedural language, which it isn't.
Far better to work with the language than against it. As previous posters
have said, you should use the xsl:for-each select attribute to choose a set
of nodes you wish to process.
Tom
-----Original Message-----
From: Devan Govender [mailto:Devan.Govender@softwarefutures.com]
Sent: 12 July 2001 13:01
To: xsl-list@lists.mulberrytech.com
Subject: Re: AW: [xsl] For loop
Is it possible to do the following :
<xsl:for-each select="EMPLOYEE_NO">
<tr>
<td WIDTH="62"><font face="Verdana" size="1"> <xsl:value-of
select="."/> </font></td>
<td WIDTH="89"><font face="Verdana" size="1"> <xsl:value-of
select="CONTRACT"/> </font></td>
<td WIDTH="191"><font face="Verdana" size="1" align="CENTER">
<xsl:value-of select="MEMBER_NAME"/> </font></td>
</tr>
<xsl:variable name="temp">
<xsl:value-of select="$counting+1"/>
</xsl:variable>
<xsl:if test="$temp = 10">
<xsl:call-template name="BILLING_TEMP2">
<xsl:with-param name="counting" select="$temp"/>
<xsl:with-param name="counter2" select="$temp2"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
<xsl:template name="BILLING_TEMP2">
<xsl:param name="counting"/>
<xsl:param name="counter2"/>
<xsl:if test="$counting < $counter2">
<xsl:call-template name="BILLING_TEMP">
<xsl:with-param name="counter" select="1"/>
<xsl:with-param name="counting" select="$counting + 1"/>
</xsl:call-template>
</xsl:template>
to simulate a for loop ???
Michael Schafer wrote:
>
> Devan,
>
> there isn't a break or continue statement. The condition IS in the
> pattern in the select attribute of the <xsl:for-each..> Element. The
> pattern defines a nodeset and the loop will be processed for all nodes
> in this set.
>
> So what you have to do is to define a suitable pattern.
>
> Michael.
>
> -----Ursprungliche Nachricht-----
> Von: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]Im Auftrag von Devan
> Govender
> Gesendet: Donnerstag, 12. Juli 2001 13:34
> An: xsl-list@lists.mulberrytech.com
> Betreff: Re: [xsl] For loop
>
> I have read about the for-each construct.
> What I need though is a way of looping and stopping the loop under
> a certain condition
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
"I count religion but a childish toy, and hold there is no sin but
ignorance." -Christopher Marlowe, 1592
"HEAVEN does'nt want me & HELL is afraid I'll take over"
DEVAN GOVENDER
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list