[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Finding the first among equals using XPath

Subject: Re: Finding the first among equals using XPath
From: "Peter Riocreux" <peter.riocreux@xxxxxxxxx>
Date: Thu, 22 Jun 2006 21:14:59 +0100
first among equals
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)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.