XPath select certain amount of levels only
Posted
by Psytronic
on Stack Overflow
See other posts from Stack Overflow
or by Psytronic
Published on 2010-04-28T11:26:39Z
Indexed on
2010/04/28
11:33 UTC
Read the original article
Hit count: 432
xpath
|xpath-expression
If I have an xml structure like this
<root>
<sub>
<node />
<node />
</sub>
<sub>
<node />
<sub>
<sub>
<sub>
<node />
</sub>
</sub>
<sub>
<sub>
<sub>
<node />
</sub>
<node />
</sub>
</sub>
<node />
<node />
</root>
Is there an xpath syntax which will only select the first three levels of nodes?
so it will collect
<root>
<sub>
<node />
<node />
</sub>
<sub />
<sub>
<sub />
</sub>
<sub>
<sub />
</sub>
<node />
<node />
</root>
Thanks, Psy
© Stack Overflow or respective owner