This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: counting loop in xslt


Pfitzner, Jan wrote:

>for (int a; a <= number;;a++){}
>  
>

Hello,

Once a variable is defined, you cannot change its value. However, you 
can use recursive template calls like (not tested, may well not work):

<xsl:variable name="number">10</xsl:variable>

<xsl:template name="loop">
<xsl:param name="a" select="0" />
<!-- Use your a -->
<xsl:value-of select="$a">
<!-- Test condition and call template if less than number -->
<xsl:if test="$a < $number">
<xsl:call-template name="loop">
<xsl:with-param name="a" value="{$a + 1}" />
</xsl:call-template>
</xsl:if>
</xsl:template>


I insist, this has not been tested.


Antonio


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]