xsl-list
[Top] [All Lists]

Re: use-when attribute?

2004-12-18 06:17:01
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.

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>