title: Increment a value in XSLT
body: <p>I'm reasonably new to xlst and am confused as to whether there is any way to store a value and change it later, for example incrementing a variable in a loop. </p>
  
  <p>I'm a bit baffled by not being able to change the value of a  after it's set doesn't make sense to me, making it more of a constant.</p>
  
  <p>For example I want to do something like this:</p>
  
  <pre><code>&lt;xsl:variable name="i" select="0" /&gt;
  &lt;xsl:for-each select="data/posts/entry"&gt;
      &lt;xsl:variable name="i" select="$i + 1" /&gt;
      &lt;!-- DO SOMETHING --&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>If anyone can enlighten me on  whether there is an alternative way to do this<br>
  Thanks</p>