This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Grouping and Sorting on value inside group


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]