[Home] [By Thread] [By Date] [Recent Entries]
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 If I have XML like the following: <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 hope that bit is clear. 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. I am stuck with using XSL 1.0 Can anyone help? Cheers, Peter
|

Cart



