Consider the following html fragment:
<table>
<tr>
<td>One</td><td>1</td>
<td>Two</td><td>2</td>
</tr>
</table>
I want to use xpath to find the second td ("1" or "2") based on the value of the first td ("One" or "Two). Something like:
/table/tr/td[text() = 'One']/../td
or
/table/tr/td[text(), 'One']/../td
Any ideas?
/table/tr/td[text()='One']/following-sibling::td[1]
"The first td
following-sibling of a td
node with text One
"
following-sibling::td?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With