I have problem to choose elements from an xml document that are exactly after other element.
In this sample I want choose element <c/> whose is exactly after <a/> element.
<root>
<object>
<a/>
<b/>
<c id="1" />
</object/>
<object>
<a/>
<c id="2"/>
</object>
</root>
And I want get element <c id="2"/>
I tried //object/c[ position()-1= (../a[position()]) ] but dont’t work.
Use
//object/c[preceding-sibling::*[1][self::a]].