[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Complex grouping problem, please help.

Subject: RE: [xsl] Complex grouping problem, please help.
From: kakridge@xxxxxxxxxxxxx
Date: Sun, 11 Jan 2004 18:59:57 -0500

Well, I couldn't even understand what you typed, so the variable
approach probably is much better for me. :)  

I was able to make your solution work, so I appreciate your help. Thank
you for answering my questions; you have cleared up a lot of confusion
for me.

Thanks again,
Kenny Akridge

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of G. Ken
Sent: Sunday, January 11, 2004 1:39 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Complex grouping problem, please help.

At 2004-01-10 21:32 -0500, kakridge@xxxxxxxxxxxxx wrote:
>The approach I am taking with this has been to for-each the first
>occurrence of every tutor in Grade node.  I then for-each a key
>all Students to based on each tutor.  I keep trying to only limit the
>key to the current grade, but I don't think it is working.

The software is working, your stylesheet is accessing all of the values
don't want.

><xsl:key name="students-by-tutor" match="Grade/Students/Name"

The above creates a *document-wide* key table.  You cannot subset the 
document-wide table when you use the key() function.

>What am I missing?

That the key() function has document-wide scope.

>The key doesn't seem to only return students in the
>given grade. It returns all students in all grades for the tutor.

Yes, it would, because of document-wide scope.

This message is timed only 9 minutes after I supplied the variable-based

grouping solution so was written without having seen my answer ...


... but the message only just arrived in my mailbox hours late, but I 
thought I would answer the questions as I did above as they are valid 

The next question is, when not using my variable-based technique, how
one use the Muenchian method to subset the document scope?  By 
incorporating in the key some value that is unique to the scope.  I used
concatenate to the start of the lookup value the generate-id() of the 
ancestral apex of the subset of document scope, followed by a space (not
name character), followed by the uniqueness within that scope.  That
on the key() function including both the ancestral apex identifier plus
lookup value.  It all works, but it is a bear to maintain and to help 
someone who is reading the code understand what is going on ... I found
variable-based method to be much easier to understand, read and

I hope this helps.

............................. Ken

North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-03-15
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

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)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:     http://XMLGuild.info
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread