This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Grouping and Sorting on value inside group
- From: Wendell Piez <wapiez at mulberrytech dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 11 Jun 2002 18:57:43 -0400
- Subject: RE: [xsl] Grouping and Sorting on value inside group
- Reply-to: xsl-list at lists dot mulberrytech dot com
At 06:13 PM 6/11/2002, you wrote:
>The expression
>
> (//dataset/*/*[generate-id() =
> generate-id(key('dataids',
concat(local-name(..),@dataId)))])
>
> would seem on the face of it to find the same node as
>
> key('dataids', concat(local-name(..),@dataId))[1]
>
> since the node inside any dataset that has the same generated ID as the
> first node in the set returned by the key expression, is that node (or
> nothing).
Yah, but since it's in a for-each I'm not just looking at the first node?
That would be so, except the generate-id() function has already filtered
out all but the first of the nodes returned by the key() function.... it
only operates on the first node in the set, when its argument is a node set
(since it returns a string, it has to pick one node and that's the one it
picks).
You might not be missing anything, but the code does what I expect, so I may
not be explaining everything properly...
Well if it's working who's complaining? :->
Taking the first node of a set returned by a key() is pretty standard as a
grouping technique ... then inside the for-each you pick up whatever you
want to group by the criterion at hand.
I was just trying to help avoid that nasty //.
Cheers,
Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list