Reputation: 787
There may be two possible structures:
1.
<c>TTTT</c>
<a>AAAA</a>
<b>BBBB</b>
<c>CCCC</c>
<d>DDDD</d>
<c>CCCC</c>
2.
<c>TTTT</c>
<a>AAAA</a>
<b>BBBB</b>
<d>DDDD</d>
<c>CCCC</c>
How can I select the node <c>
after <b>
in first case and if it is the second case, set it null?
Upvotes: 1
Views: 300
Reputation: 89325
You can use following-sibling
axis for this purpose :
//b/following-sibling::*[1][self::c]
Brief explanation :
b/following-sibling::*[1]
: get direct sibling following a <b>
[self::c]
: check if that sibling is a <c>
element
Upvotes: 2