First find the span
with AFN
text and class="uccResCde"
, then get the preceding-sibling
:
//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()
سؤال
I am trying to write an XPath to pull the value 55.3469 from the tag below., but I am not sure where to start.
<tr class="uccRes">
<td width="47%" align="right" class="leftCol">100.00 <span class="uccResCde">ALL</span><!-- This is test data. -->
</td>
<td width="6%" valign="middle" align="center">=</td>
<td width="47%" align="left" class="rightCol">55.3469 <span class="uccResCde">AFN</span><!-- This is test data. -->
</td>
</tr>
المحلول
First find the span
with AFN
text and class="uccResCde"
, then get the preceding-sibling
:
//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()