title: Using XPATH previous:: more like an array
body: <p>I've got XML like this</p>
  
  <pre><code>&lt;root&gt;
    ...
    &lt;a&gt;
    &lt;a&gt;
    &lt;a&gt;
    &lt;c&gt;
  ...
  </code></pre>
  
  <p>It's very flat with LOTS of A elements and a few C elements. The A elements are sensor data and the last reading is bogus, I need the one before. So I'd like to use the C elements as a marker and each of A elements 2 before each C. So I'm trying out an XPATH like:</p>
  
  <pre><code>/root/c/preceding-sibling::a
  </code></pre>
  
  <p>but I'm getting all previous A elements, I was hoping for something a bit more direct such as:</p>
  
  <pre><code>/root/c/preceeding-sibling[-2]
  </code></pre>
  
  <p>which would just grab the 2nd sibling before C (no matter the type) I guess I'm asking for array like functionality on an XPATH so what ever I match I can ask for "the second element before that"</p>
  
  <p>Is this possible?</p>