title: XPath selecting the node right after the criteria matching node
body: <p>am trying to use XPATH to extract data from XHTML files, I have a scenario where I want  to a match a TD element and then get the TD right after it. </p>
  
  <p>Here is the HTML sample </p>
  
  <pre><code>  &lt;tr&gt; 
       &lt;td colspan="3" style="border-top:1px solid rgb(234,234,234);padding:0pt 0pt 16px;width:560px"&gt;   &lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
       &lt;td colspan="2" style="font:12px/18px Arial,sans-serif;padding:0 10px 0 0;color:rgb(51,51,51);width:480px" align="right" valign="top"&gt; Item Subtotal: &lt;/td&gt; 
       &lt;td style="font:12px/18px Arial,sans-serif;color:rgb(51,51,51);width:80px" align="right" valign="top"&gt; $25.79 &lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
       &lt;td colspan="2" style="font:12px/18px Arial,sans-serif;padding:0 10px 0 0;color:rgb(51,51,51);width:480px" align="right" valign="top"&gt; Shipping &amp;amp; Handling: &lt;/td&gt; 
       &lt;td style="font:12px/18px Arial,sans-serif;color:rgb(51,51,51);width:80px" align="right" valign="top"&gt; $0.00 &lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
       &lt;td colspan="2" style="font:12px/18px Arial,sans-serif;padding:0 10px 0 0;color:rgb(51,51,51);width:480px" align="right" valign="top"&gt; Total Before Tax: &lt;/td&gt; 
       &lt;td style="font:12px/18px Arial,sans-serif;color:rgb(51,51,51);width:80px" align="right" valign="top"&gt; $25.79 &lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
       &lt;td colspan="2" style="font:14px Arial,sans-serif;padding:10px 10px 10px 0;color:#333;width:480px" align="right" valign="top"&gt; Shipment Total: &lt;/td&gt; 
       &lt;td style="color:#333;font:14px Arial,sans-serif;padding:10px 0 5px 0;color:#333;width:80px" align="right" valign="top"&gt; &lt;b&gt; $25.79 &lt;/b&gt; &lt;/td&gt; 
      &lt;/tr&gt; 
  </code></pre>
  
  <p>What am trying to do is, get the TD element with has "Shipment Total" and then extract the value from the TD element right after it. I managed to select the element using XPATH but cannot find a way to jump to the next element</p>
  
  <pre><code>xhtml = etree.HTML(i.get('content').encode('utf8'))
  result = etree.tostring(xhtml, pretty_print=True, method="html")
  root = html.fromstring(result)
  print root.xpath('//td[contains(text(), "Shipment Total:")]')
  </code></pre>
  
  <p>Its easier todo that in BeautifulSoup but am restricted with XPath, anyone can help if this would be possible?</p>
  
  <p>thanks</p>