XSLT/XPath help

R

Ralph Snart

I have a bunch of nodes called <product>. Some of them will have <gumball_id>
child elements. How can I get the first 4 products that have gumball_ids ?

The previous programmer wrote:

select="product[gumball_id!=''][position() &lt; 4]"

But that only looks at the first 4 <product>s. It doesn't find the first 4
with a specific child.

-rs-
 
R

Richard Tobin

Ralph Snart said:
select="product[gumball_id!=''][position() &lt; 4]"

But that only looks at the first 4 <product>s. It doesn't find the first 4
with a specific child.

Yes it does. Well, actually, it finds the first 3, because they are
numbered from 1, and only considers those with a gumball_id child that
contains some text.

-- Richard
 
D

Dimitre Novatchev

Ralph Snart said:
I have a bunch of nodes called <product>. Some of them will have
<gumball_id>
child elements. How can I get the first 4 products that have gumball_ids
?

The previous programmer wrote:

select="product[gumball_id!=''][position() &lt; 4]"


product[gumball_id][position() &lt; 5]
 

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,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top