[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
Re: [xsl] Two-level grouping problem
Subject: Re: [xsl] Two-level grouping problem From: "Aron Bock" <aronbock@xxxxxxxxxxx> Date: Tue, 10 May 2005 21:09:12 +0000 |
<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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Two-level grouping proble, JBryant | Thread | Re: [xsl] Two-level grouping proble, JBryant |
[xsl] Unique html name, id, and for, Jeremy Marzka | Date | Re: [xsl] Two-level grouping proble, JBryant |
Month |