Reputation: 361
So I have the following XML
<a>
<b>
<TR>
<FS>AG</FS>
<TRC>
<c>
<date>1234</date>
</c>
</TRC>
</TR>
<TR>
<FS>XYZ</FS>
<TRC>
<c>
<date>5678</date>
</c>
</TRC>
</TR>
</b>
</a>
I'm trying to select all the dates where the FS tag is "AG", So for the given XML it should return 1234
I have been trying the following but it's not working.
/a/b/TR[FS = 'AG']/TRC/c/date
Upvotes: 0
Views: 451
Reputation: 338208
"all the dates where the FS tag is 'AG'"
//date[ancestor::TR[1]/FS = 'AG']
or the other way around
//TR[FS = 'AG']//date
Upvotes: 2