Ralph Goers wrote:

Andres Taborda wrote:

hello list,

excuse me by the following question

progamming in any language a value auto-increment is
for ($i=1;$i<6;$i++)
$i+=1;

in xsl how can make the auto-increment.

I have the follow code, not make sum and
auto-increment

<!--value initial -->
<xsl:variable name="posX">1</xsl:variable>

<!-- this cicle have 5 element-->
<xsl:for-each select="child::*">
<xsl:variable name="posX">
<xsl:value-of select="$posX + 1"/>
</xsl:variable>
</xsl:for-each>


Variables in XSL are immutable; their values cannot be modified once they are set. To accomplish what you are after you have to use a recursive call to a template. The template accepts the variable as a parameter and increments it when it is passed on each call.

The question is what are you trying to do? There is probably an XSL way of doing it. Such as:
<xsl:for-each select="child::*">
<xsl:value-of select="pos()"/>
</xsl:for-each>


Regards, Upayavira


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to