xpath expression to select by absolute index
- From: tomek.romanowski@xxxxxxxxx
- Date: 23 Oct 2006 09:36:23 -0700
Hello everybody !
I'm looking for a while some way to select subnode element by its
position within whole document rather then in its parent.
Let's consider following xml:
<root>
<parent>
<subnode id="x1" value="y1"></subnode>
<subnode id="x2" value="y2"></subnode>
<subnode id="x3" value="y3"></subnode>
</parent>
<parent>
<subnode id="x4" value="y1"></subnode>
<subnode id="x5" value="y2"></subnode>
</parent>
</root>
I would want to use xpath like this
/root/parent/subnode[4]
to select element subnode with attribute x4.
However it doesn't work. Usage of 4 is an abbreviation for usage
position()=4. As I read, position has a contextual nature, so it works
in context of parent element.
Any help would be appreciated.
BR/Tomek
.
- Follow-Ups:
- Re: xpath expression to select by absolute index
- From: Martin Honnen
- Re: xpath expression to select by absolute index
- Prev by Date: Re: How do I find the MSXML version?
- Next by Date: Re: xpath expression to select by absolute index
- Previous by thread: Re: Special Characters not resolving
- Next by thread: Re: xpath expression to select by absolute index
- Index(es):