• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to increment a value in xsl?

 
Viswanathan Ramasamy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I want to increment a valu in xsl.
Code :

1 <xsl:variable name="uniqueID_Address1" select="'0'"/>
2 <xsl:for-each select="Z">
3 <xsl:if test="@n=$uniqueID">
4<xsl:value-of select="$uniqueID_Address1=$uniqueID_Address1+1"/>
5 </xsl:if>

I'm getting false in line no 4.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viswanathan,

You can not change the variable value in XSL not like the other languages.

Try using recursion

Regards
Ahmad
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viswanathan,

You can not change the variable value in XSL not like the other languages.

Try using recursion

Regards
Ahmad
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XSLT is not a procedural language like Java, it is a functional language. And it has a lot of functions (courtesy of XPath) that allow you to write it that way. So something like:is the replacement for those 5 lines.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic