title: How to increment a XSL integer variable
body: <p><strong>Updated</strong></p>
  
  <p>I have some huge data, which becomes a large table say <strong>table parent</strong> </p>
  
  <p>each <strong>table parent</strong>'s row will correspond to another table (code given below) say <strong>table child</strong> So when any particular column from the <strong>table parent</strong> row is clicked (hyperlinked) it goes to that part of table <strong>table child</strong> </p>
  
  <p>so i need a counter to differentiate between each <strong>table child</strong>. Please help me figure out this problem. Thanks</p>
  
  <pre><code>&lt;xsl:choose&gt;
      &lt;xsl:variable name="counter" as="xs:integer"/&gt;
      $counter=0      &lt;!--here i am assigning 0--&gt;
      &lt;xsl:when test="DBInfo/ORSDBInfo/ORSReposTableTypeInd1/ORSReposColumAllWithTableTypeInd1/@ColumnNm"&gt;
          &lt;dd&gt;
              &lt;xsl:for-each select="DBInfo/ORSDBInfo/ORSReposTableTypeInd1"&gt;
                  &lt;div class="horz"&gt;
                  &lt;a name="_ORS$counter" href="#_top"&gt;ORSReposColumAllWithTableTypeInd1:&lt;xsl:value-of select="$counter"/&gt; &lt;/a&gt;
                  &lt;table border="1"&gt;          &lt;!--above I am using counter to print--&gt;
                      &lt;tbody&gt;
                          &lt;tr&gt;
                              &lt;th&gt;Creator&lt;/th&gt;
                              &lt;th&gt;LastUpdate&lt;/th&gt;
                              &lt;th&gt;UpdatedBy&lt;/th&gt;
                          &lt;/tr&gt;
                  &lt;xsl:for-each select="ORSReposColumAllWithTableTypeInd1"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;xsl:value-of select="@Creator"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;xsl:value-of select="@LastUpdate"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;xsl:value-of select="@UpdatedBy"/&gt;
                      &lt;/tr&gt;
                  &lt;/xsl:for-each&gt;
                      &lt;/tbody&gt;
                  &lt;/table&gt;
              &lt;/div&gt;
              $counter=$counter+1     &lt;!--Counter is incremented--&gt;
              &lt;br/&gt;
              &lt;/xsl:for-each&gt;
          &lt;/dd&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
      &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p><strong>More Updates</strong></p>
  
  <p>So after referring to Wilfred's answer I came up with </p>
  
  <pre><code>&lt;a name="_ORS" href="#_top"&gt;ORSReposColumAllWithTableTypeInd1_&lt;xsl:number value="position()" format="1" /&gt;&lt;/a&gt;
  </code></pre>
  
  <p>but now how to use it inside <code>&lt;a name="_ORS"</code> so that i get _ORS1, _ORS2, _ORS3 and so on...</p>