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

Re: Two-level grouping problem

Subject: Re: Two-level grouping problem
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Tue, 10 May 2005 21:09:12 +0000
aron level
<xsl:if test="generate-id(.)=
generate-id($rows[TYPE/@value=current()/TYPE/@value and
SUB_TYPE/@value=current()/SUB_TYPE/@value])">

There's a bit more going on here than a prior respondent wrote.


As correctly noted, generate-id() returns an unique ID for a given node; thus generate-id(.) on the LHS computes an ID for the current node.

The generate-id() on the RHS also computes an ID, but with some implicit constraints. Namely, $rows[...] returns all rows *in document order* whose TYPE and SUB_TYPE match those of the current node, and generate-id() returns the ID of the *first* of those nodes. The document order part is important, becuse it means the ID from the LHS will equal the ID from the RHS only when the node on the LHS is the first of its kind in the document.

The idea is, we want to show only 1 each of nodes with the same TYPE, SUB_TYPE values. Thus, get a list of nodes, and cull out just the first of each such group. This is explained on the section on grouping at www.jenitennison.com. Not to confuse the issue, but you may see that we could as well use the value of the last() node of $rows[...] above to same effect.

So what that outer loop does is end up with only those nodes whose TYPE and SUB_TYPE are the first of their kind, based on their respective @value attributes.

The process is repeated for inner-values.

Regards,

--A

From: Max Bronsema <max.bronsema@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Two-level grouping problem
Date: Tue, 10 May 2005 11:26:13 -0600

Hi Ken,

http://www.xslt.com/html/xsl-list/2002-05/msg00486.html


_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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.