Emulating axis "following-sibling-or-self" without union?

Niall Smart

Usenet Archive
Joined
Mar 5, 2004
Messages
1
Reaction score
0
Hi

I'm trying to emulate a "following-sibling-or-self" XPath axis without using the union operator. The XML looks like this:

<deeply-nested>
<select>
<option value="1">One</option>
<option value="2" selected="selected">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
</deeply-nested>

I want the option that is selected and subsequent options (i.e., 2, 3 and 4). Is there a convenient way to do this without unioning two node sets?

Thanks

Niall
 

Dimitre Novatchev MVP XML

Usenet Archive
Joined
Feb 11, 2004
Messages
43
Reaction score
0
Niall Smart said:
Hi

I'm trying to emulate a "following-sibling-or-self" XPath axis without using the union operator. The XML looks like this:

<deeply-nested>
<select>
<option value="1">One</option>
<option value="2" selected="selected">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
</deeply-nested>

I want the option that is selected and subsequent options (i.e., 2, 3 and 4). Is there a convenient way to do this without unioning two node sets?

Use:

/*/*/option[following-sibling::eek:ption[1][@selected]] /
following-sibling::eek:ption

Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top