Say I have this XML:
<root>
<A></A>
<B></B>
<C>one</C>
<C>two</C>
<C>three</C>
<D></D>
</root>
Now I want to get all nodes, except for The C nodes 'two' and 'three'. Now I want to choose which C node can stay by index.
So this is the xpath that I already have:
//*[not(ancestor-or-self::C)]
But this removes all C nodes, so now I have to add an index to which C node I want to stay
//*[not(ancestor-or-self::C)] exept for C[1]
How can I accomplsh this so my output would be if I select index 1:
<root>
<A></A>
<B></B>
<C>one</C>
<D></D>
</root>
Or if I select index 2:
<root>
<A></A>
<B></B>
<C>two</C>
<D></D>
</root>
Hope I made myself clear enough :p thx