[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: JBryant@xxxxxxxxx
Date: Tue, 10 May 2005 13:19:37 -0500
xsl group records
Hi, Max,

The algorithm in Ken's stylesheet goes like this:

1. Read the records into a variable.
2. For each record in the variable, get each member of the set that has 
distinct type and subtype values (this is the outer group).
3. Read the outer group records into a variable.
4. For each record in the outer group, get the first of the records with a 
distinct code value (this is the inner group).

The particular statement you quoted ensures that the outer group contains 
only unique values. This statement permits the first record with a 
particular type and subtype to get to the rest of the process and blocks 
the following ones. That happens because the predicate always finds the 
first matching record. So, when the second (or later) record with those 
characteristics hits the if statement, it fails because it has a different 
ID than the one the predicate matches. (The predicate is the part within 
the brackets: [TYPE/@value=current()/TYPE/@value and 
SUB_TYPE/@value=current()/SUB_TYPE/@value]).

Ken isn't assigning an ID in that statement. He's using the fact that an 
XSLT processor must generate unique IDs for every element to get just one 
from a set of several identical elements. In that fashion, he cracks the 
grouping problem.

I hope I have been sufficiently clear. I also hope I have not been overly 
pedantic, but I know you are new to XSLT.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)





Max Bronsema <max.bronsema@xxxxxxxxx> 
05/10/2005 12:26 PM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
Re:  Two-level grouping problem






Hi Ken,

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

At the above link I would appreciate help in understanding this
snippet of xslt.

================================================================
<xsl:if test="generate-id(.)=
                    generate-id($rows[TYPE/@value=current()/TYPE/@value 
and
 SUB_TYPE/@value=current()/SUB_TYPE/@value])">
================================================================

Is $row comparing different nodes and making sure they are equal or is
this just setting the id for both TYPE and SUB_TYPE? Or am I just
totally out in left-field?

Thanks,

Max Bronsema



On 5/9/05, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> At 2005-05-09 09:42 -0700, atlstjohn@xxxxxxxxx wrote:
> >Im having a frustrating time getting multi-level
> >grouping to work as expected. Ive tried every variant
> >of the muenchian method I could think of
> 
> I find multi-level grouping is more easily handled using a 
variable-based
> grouping method, because the Muenchian method works with document-wide 
scope.
> 
> You'll find various archives with posts such as the following showing 
examples:
> 
>    http://www.xslt.com/html/xsl-list/2002-05/msg00486.html
> 
>    http://www.biglist.com/lists/xsl-list/archives/200401/msg00340.html
> 
> I hope this helps.
> 
> . . . . . . . . Ken
> 
> --
> World-wide on-site corporate, govt. & user group XML/XSL training.
> G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
> Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
> Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
> Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.