searching for nth element via XPATH
Hi,
How can I retrieve let say the 4th element label from a well formed and valid XML file? Assumption is the xml file has sequence
of elements with different labels and there are no child in between those elements. I tried for example //ddd[position() mod 4 = 0]and this will get me the 4th ddd from the root, however with this search I have to know ddd is the label. How do I search for the generic nth level element label?
example.xml
<AAA>
<BBB/>
<BVB/>
<ZBB/>
<BBY/>
<RNZ name="x" /> <!-- <- i want to pick this 5th element and its label RNZ -->
<BXS/>
<BBB/>
<ABB/>
<CCC/>
<CCC/>
<CCC/>
</AAA>
Perhaps to put it another way:
How to position one to any arbitrary level node choosen without knowing the label? What if I only know the level as I can visually count it? My understanding is "." is the current
node, but first I need to bring the pointer(?) to this node whatever level or depth it should be.