title: Mimicking position(node-set) in XSLT 1.0?
body: <p>XSLT 2.0 offers the benefit of passing a node-set param as part of the position() function.  Unfortunately, that is not available in XSLT 1.0.  Is there a way to mimic this behavior?</p>
  
  <p>For example, given this XML:</p>
  
  <pre><code>&lt;wishlists&gt;
    &lt;wishlist name="Games"&gt;
      &lt;product name="Crash Bandicoot"/&gt;
      &lt;product name="Super Mario Brothers"/&gt;
      &lt;product name="Sonic the Hedgehog"/&gt;
    &lt;/wishlist&gt;
    &lt;wishlist name="Movies"&gt;
      &lt;product name="Back to the Future"/&gt;
    &lt;/wishlist&gt;
  &lt;/wishlists&gt;
  </code></pre>
  
  <p>and this XSLT 2.0:</p>
  
  <pre><code>&lt;xsl:value-of select="position(/wishlists/wishlist/product)"/&gt;
  </code></pre>
  
  <p>the value "4" would be returned when processing the final "Back to the Future" node.</p>
  
  <p>Unfortunately, the closest I seem to be able to get with XSLT 1.0 is the following:</p>
  
  <pre><code>&lt;xsl:template match="product"&gt;
    &lt;xsl:value-of select="position()"/&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>However, I would get a value of "1" in the same "Back to the Future" node, as opposed to the "4" value that I really want.</p>