Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Adding values to a variable [Thread Next] Re: Adding values to a variableTo: NULL Date: 12/13/2007 10:28:00 AM <khalil_mi@h...> wrote in message news:4e8f6899-86c4-48e4-8660-a6078099b014@1...... > Hi > > I am using XSL Version 2 > > I am trying to use this code to add a value (say 100) to the variable > summation > > <xsl:variable name="summation">0</xsl:variable> > <xsl:template match="csv:csv"> > <xsl:element name="csv:csv"> > <xsl:for-each select="/csv:csv/csv:line"> > <xsl:variable name=" summation " select="$summation + 100"/> > <xsl:value-of select="$summation "/> > </xsl:for-each> > </xsl:element> > </xsl:template> > > The value printed by value-of statement is always 100. I need the > variable summation to accumulate the values added to it > Variables in XSL are immutable. Once set they can not be modified. Also a variable in a for-each is scoped only in the current iteration hence the next iteration gets its own instance of the variable. -- Anthony Jones - MVP ASP/ASP.NET | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
