TechGlider
02-20-2009, 09:31 PM
I need some help creating a dynamic variable..
I need to set up a variable that you can add to:
Can something like this be done --> This will be a for-each clause which will be looping through each set of node finding a child node, lets just say named = "amount"
so for example:
<account>
<name />
<account_number />
<amount> x </amount>
</account>
<xsl:variable name="current_value">0</xsl:variable>
<xsl:for-each select="/account">
<xsl:value-of select="$current_value + amount" /> <!-- i need this amount to be set to the current_value of this value -->
</xsl:for-each>
What i need to is set up a dynamic variable like this " current_value = current_value + amount "
So every time it goes through and hits the node amount it adds it to the current_value?
I need to set up a variable that you can add to:
Can something like this be done --> This will be a for-each clause which will be looping through each set of node finding a child node, lets just say named = "amount"
so for example:
<account>
<name />
<account_number />
<amount> x </amount>
</account>
<xsl:variable name="current_value">0</xsl:variable>
<xsl:for-each select="/account">
<xsl:value-of select="$current_value + amount" /> <!-- i need this amount to be set to the current_value of this value -->
</xsl:for-each>
What i need to is set up a dynamic variable like this " current_value = current_value + amount "
So every time it goes through and hits the node amount it adds it to the current_value?