title: Get the total number of elements (iterations) in an XSLT for-each loop
body: <p>I normally use jquery templates for this sort of thing but I inherited an XSLT file I need to update but I can't find a way to get the total number of elements (iterations) for a specific template call. </p>
  
  <p>With jquery templates I'd do something like this and it would give me total number of assets that I'm looping through. </p>
  
  <pre><code>&lt;span id="${spnID}"&gt;
      ${GroupName} (${Assets.length})
  &lt;/span&gt;
  </code></pre>
  
  <p>This would return me "Product x (5)" if there were five elements in the loop.</p>
  
  <p>It seems simple but I can't seem to find a way to do the same thing with XSLT. Something like this, I think:</p>
  
  <pre><code>&lt;span id="{$SpnId}"&gt;
      &lt;xsl:value-of select="$GroupName"/&gt; (&lt;xsl:value-of select="$total-number-of-elements"/&gt;)
  &lt;/span&gt;
  </code></pre>