1

How could I extract the number "-105" with XPath 1.0/2.0?

<td class="alignRight bookColumn" rel="page1" style="">
  <div id="_Div_Line_5_523714_901_3_119">-115</div>
  <div id="_Div_Line_5_523714_902_3_119">   
    <div class="oddsAlignMiddleOne">9.0</div>                        
    -105
  </div>
</td>

I tried with:

/td/div[2]/text()
kjhughes
  • 106,133
  • 27
  • 181
  • 240
Fernando
  • 23
  • 4

1 Answers1

2

To select "-105", use the following-sibling axis:

normalize-space(/td/div[2]/div/following-sibling::text())
kjhughes
  • 106,133
  • 27
  • 181
  • 240