Re: "sorted" axis (was: Remove duplicates from a node-set accordi ng to content)

Subject: Re: "sorted" axis (was: Remove duplicates from a node-set accordi ng to content)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 30 Jul 1999 11:30:14 +0100 (BST)
> I'm not sure an empty element feels right: there's a need to delineate the
> processing that happens at each level of grouping, something like:
> ...
> The other thing I haven't done (which is really why I made the remark about
> report writers) is to link it in with totalling; with updatable variables
> it's easy enough to accumulate subtotals at each grouping level, but without
> them, it's a little tricky to show a subtotal over the items in a group.

grouping and totalling would be easy enough if you could first sort the
input and then just walk over the sorted tree again with some more
templates, perhaps in a different mode (or perhaps not, if the result
temlates already had nodes distinct from the source tree, eg from a
different namespace)

ie if you could go
<xsl:variable name="firstpass">
 <xsl:for-each, or apply-templates or whatever
  <xsl:sort something...
</xsl:variable>

which gives you a `result tree fragment' in $firstpass, but then to
think of that as an _input_ tree, something like

<xsl:apply-templates mode="secondpass" select="$firstpass"/>

once the nodes are in sorted order, it is easy enough to put
containing elements around consecutive groups, and to do running totals
etc. (actually grabbing consecutive things into a containing group may
not be completely obvious, but it isn't hard, and one would hope that
over time the archive of useful named templates could be built up to do
this sort of thing, rather than having to keep extending the language)


David


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


Current Thread