xsl-list
[Top] [All Lists]

Re: [xsl] Finding the first among equals using XPath

2006-06-22 13:15:21
something like

<xsl:for-each select="W">
  <xsl:for-each select="X[not(@Y=../following-sibling::X/@Y)]">
    something

Thanks David (and everyone else who replied, but David got there
first!) - exactly the kind of thing I was after. The .. inside the
predicate should not be there but you did say "something like"....

I was working along the right lines before, but was trying to count
the nodeset of siblings of the context node with the same attribute
value, which involved a predicate inside the predicate and  I needed
the broader vision.

I have written lots of XSL, but only basic stuff and now I am
revisiting some of it I am keen to do a better job, so I would be
grateful if someone would confirm my understanding of the above
(without the ..)

I think it is saying select all X for whom it is not true that the
value of the attribute Y is equal to the value of the same attribute
on any following sibling X. In which case it is choosing the last X
with each value of Y. The .. is not needed because the context in
which the attribute is seen is an X and so searching for its siblin Xs
is at the same level.

Is that all correct?

Cheers,

Peter (A very happy one who you may see asking more dumb questions on this list)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>