xsl-list
[Top] [All Lists]

RE: Complex grouping problem, please help.

2004-01-11 16:59:57
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(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of G. 
Ken
Holman
Sent: Sunday, January 11, 2004 1:39 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Complex grouping problem, please help.

At 2004-01-10 21:32 -0500, kakridge(_at_)bellsouth(_dot_)net 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
matching
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
you 
don't want.

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

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 ...

   http://www.biglist.com/lists/xsl-list/archives/200401/msg00340.html

... 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 
questions.

The next question is, when not using my variable-based technique, how
would 
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
to 
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
a 
name character), followed by the uniqueness within that scope.  That
relies 
on the key() function including both the ancestral apex identifier plus
the 
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
the 
variable-based method to be much easier to understand, read and
maintain.

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(_at_)CraneSoftwrights(_dot_)com
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



<Prev in Thread] Current Thread [Next in Thread>