XML : Get nth element if it doesn't contain a class

I am trying to get 6th tag as long as it doesn't contain a class. Sometimes there are 7 elements and sometimes 6. The structure is either like this

  <tr>     <td class ="name">XXX</td>     <td>0</td>     <td>10</td>     <td>5</td>     <td>3</td>     <td>6</td>     <td class="final>24</td>  </tr>    

Or

  <tr>     <td class ="name">XXX</td>     <td>0</td>     <td>10</td>     <td>5</td>     <td>3</td>     <td class="final>18</td>  </tr>    

I want to either return the 6 if it exists (first example) or blank if it doesn't (second example).

I've tried

  /tr[1]/td[6 And not(@class)]     

but that appears to return everything without a class.

Thanks

No comments:

Post a Comment