This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Grouping and Sorting on value inside group
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Hunsberger, Peter" <Peter dot Hunsberger at stjude dot org>
- Cc: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 12 Jun 2002 21:14:13 +0100
- Subject: Re: [xsl] Grouping and Sorting on value inside group
- Organization: Jeni Tennison Consulting Ltd
- References: <601F6322AD71D5118D6C0003472515290660CED1@sjmemexc1.stjude.org>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Peter,
>>>> so <xsl:key name="dataset" match="dataset" use=" 'all' "/>
>>>> and key("dataset", " 'all' ")
>>>> doesn't work?
>>
>> Just to point out that this is equivalent to:
>>
>> <xsl:variable name="dataset" select="//dataset" />
>>
>> and:
>>
>> $dataset
>
> now we are going in circles :-) I had asked if there was a way to
> eliminate the use of //dataset/*/* in my code. That had in turn led
> to the key 'all' solution...
Right, but they do exactly the same thing -- they both go through all
the nodes in the document to identify the dataset elements within the
document. My guess is that the variable will take up less space than
the key, since it's a simpler construct, and the node set that it
contains only has to be constructed once rather than constructed each
time you call the key.
I guess it comes down to realising that just because you don't
*explicitly* use // doesn't mean that you're visiting less nodes, and
it's the node visits that take the time rather than the descendant
axis per se. The other reason that I brought up using a variable is
that there's more prospect for improving the select expression setting
the variable than there is for improving the match pattern on the key.
For example, you might be able to use:
<xsl:variable name="dataset" select="/root/dataset" />
instead, which would mean *a lot* fewer visits.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list