title: XML Node position
body: <p>How do I get relative position of a node in a given XML. Say I have below xml, I want to know first b node in second a is position 3.</p>
  
  <pre><code>&lt;a&gt;
      &lt;b&gt;&lt;/b&gt;
      &lt;b&gt;&lt;/b&gt;
  &lt;/a&gt;
  &lt;a&gt;
      &lt;b&gt;&lt;/b&gt;
      &lt;b&gt;&lt;/b&gt;
  &lt;/a&gt;
  
  
  &lt;xsl:for-each select="a"&gt;
              &lt;dummy&gt;
              &lt;xsl:for-each select="b"&gt;
                  &lt;xsl:variable name="pos" select="position()" /&gt;
                  &lt;dummy2&gt;&lt;xsl:value-of select="$pos"/&gt;&lt;/dummy2&gt;
              &lt;/xsl:for-each&gt;
             &lt;/dummmy&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>I expect dummy2 to have 1,2,3,4 values.</p>
  
  <pre><code>&lt;dummy&gt;
      &lt;dummy2&gt;1&lt;dummy2&gt;
      &lt;dummy2&gt;2&lt;dummy2&gt;
  &lt;/dummmy&gt;
  &lt;dummy&gt;
      &lt;dummy2&gt;3&lt;dummy2&gt;
      &lt;dummy2&gt;4&lt;dummy2&gt;
  &lt;/dummmy&gt;
  </code></pre>