<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(_dot_)bronsema(_at_)gmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
_________________________________________________________________
Don?t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--