xml:
<root0>
<elem1>
<elem21 xlink:href="21"/>
<elem22>
<elem31 xlink:href="31"/>
<elem32>
<elem41 xlink:href="41"/>
</elem32>
</elem22>
</elem1>
</root0>
the depth is unknown. How can I select all elements with xlink:href attribute?
I tried the following:
*[@xlink:href]
self::*[@xlink:href]
Any guidance is appreciated.
For just children of grandchildren use
descendant-or-self::*[@xlink:href]
For all nodes just add // in front of your xpath
//*[@xlink:href]
Also, your xml sample is not valid but I'm guessing it is just a sample.