|
Subject: [xsl] Finding the first among equals using XPath From: "Peter Riocreux" <peter.riocreux@xxxxxxxxx> Date: Thu, 22 Jun 2006 16:45:15 +0100 |
I am sure this is a hoary old one, but I could not work out the right runes to achieve it, nor the right keywords to search for to find an answer
<V>
<W>
<Z/>
<X Y='0'/>
<X Y='0'/>
<X Y='1'/>
<Z/>
</W>
<W>
<Z/>
<Z/>
<X Y='0'/>
<X Y='1'/>
<X Y='2'/>
</W>
<W>
<X Y='2'/>
<X Y='2'/>
<X Y='2'/>
<Z/>
<Z/>
</W>
</V>I a have a for-each loop over the W elements. Inside the for-each I want to select one X with each value of Y that exists within that W.
So for the above example, for //W[1] I want to get the first and third or second and third X elements, for //W[2] I want all three X elements and for //W[3] I want any one of the X elements, but only one of them.
I have run out of ideas now, so I have finally admitted defeat (a hard thing for an engineer) and am asking for your collective wisdom.
I want a node-set so I can do a for-each on that, so I would prefer to find a select specifier based on clever use of axes and predicates.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Merging attributes in one, Mukul Gandhi | Thread | Re: [xsl] Finding the first among e, David Carlisle |
| Re: [xsl] Merging attributes in one, Wendell Piez | Date | [xsl] RE : Re: [xsl] XSLT convert x, Florent Georges |
| Month |