title: Xpath select n-th node
body: <p>I have a XML like this</p>
  
  <pre><code>&lt;div class="yay"&gt;
   &lt;div class="foo"&gt;&lt;/div&gt; 
   &lt;div class="foo"&gt;&lt;/div&gt;
   &lt;div class="bar"&gt;&lt;/div&gt;
   &lt;div class="foo"&gt;&lt;/div&gt;
   &lt;div class="bar"&gt;&lt;/div&gt;
   &lt;div class="foo"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Is there a way to select the n-nth div where class is "foo"?</p>
  
  <p>I'd select all foos with <code>//div[@class="yay"/div[@class="foo"]</code></p>
  
  <p>If I want to select foo #3 how do I do that? Something like:</p>
  
  <p><code>//div[@class="yay"/div[@class="foo"][3]</code> ? </p>