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

N

Niall Smart

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
 
D

Dimitre Novatchev [MVP XML]

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
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top