[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] use-when attribute?


Subject: Re: [xsl] use-when attribute?
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Sat, 18 Dec 2004 14:17:01 +0100

Hi Bruce,

I was originally using keys (at your suggestion, in fact), but Mike Kay at one point seemed to suggest it better for my purposes to use a variable. I didn't quite understand why, but here's his explanation:

====
I don't really see what a key with a constant "use" expression achieves.
Apart from the fact that it applies to whichever document is current at the
time, you could just as well (and probably better) use a global variable

<xsl:variable name="citekey" select="//db:biblioref/@linkend"/>
====

You said: .... but I'm worried that's a bad idea from a performance standpoint. Any other alternatives?

So I gave you this one. It builds the same node set, but I am quite sure it won't need three loops through the document _and_ a union of the three results.

The big difference is that those global variables execute expressions. The keys contain match patterns. I am pretty sure that all keys are built with only a single pass through the document. If it isn't so, than the programmers haven't implemented it very cleverly, I would say...

I remember Mike saying that, and true, in that particular case it didn't really matter. But when adding multiple variables with such expressions, or a single one with a union like you suggested, I think it does...

Cheers.


Current Thread