RE: [xsl] Complex grouping problem, please help.
Subject: RE: [xsl] Complex grouping problem, please help.|
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Jan 2004 13:38:38 -0500
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 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
<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 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.
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
G. Ken Holman - Sat, 10 Jan 2004 21:23:21 -0500
- [xsl] Re:, (continued)
- Mukul Gandhi - Sat, 10 Jan 2004 08:18:13 +0000 (GMT)
- kakridge - Sat, 10 Jan 2004 11:00:16 -0500
- kakridge - Sat, 10 Jan 2004 12:29:51 -0500
- kakridge - Sat, 10 Jan 2004 21:32:47 -0500
- G. Ken Holman - Sun, 11 Jan 2004 13:38:38 -0500 <=
- kakridge - Sun, 11 Jan 2004 18:59:57 -0500
- kakridge - Sat, 10 Jan 2004 23:42:06 -0500