Re: [xsl] use-when attribute?

Subject: Re: [xsl] use-when attribute?
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Mon, 20 Dec 2004 19:01:25 +0100
In short, it isn't hard for a system to evaluate this expression in a single
scan, or perhaps three scans, and there is no need to allocate any memory
for temporary results.

All true (a through e), but how is a mere user like supposed to know what is optimized and what not. I was about to ask what is quicker: //a|//b|//c or //*[self::a or self::b or self::c] (an 'optimization' I often do myself). But if I understand correctly, you say that it is most likely that both are optimized to the same and therefor equally fast?


Even if the result of //a|//b|//c is assigned to a variable and you then do
count() on the variable, the system may be able to tell that it doesn't need
to allocate memory to hold the value (it might be able to see that it's only
used once).

Yes, very true, but I couldn't think that quickly of any other testcase. Do you have suggestion that is hard to optimize and therefor a reliable testcase?


The main reason the key is slower in this case is that you are only using it
once. But there's no good reason for ever using a key with a fixed use
expression more than once, because you could always put the result of the
first evaluation in a variable. So yes, I can't see any reason for using
this construct.

Using it once _and_ with a fixed use value. Twice inefficient...


Cheers,
Geert

Current Thread