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]

Re: Testing if something is not there


Hi Mike,

> Saxon currently evaluates all variables except node-set variables at
> the time they are declared. For node-set variables, it evaluates the
> select expression the first three times the variable is referred to;
> the third time, it saves the value of the variable in memory. This
> is a time/space trade-off: for many simple node-set expressions such
> as "following-sibling::*", allocating space to hold the value is
> more expensive than re-evaluating it on each reference.

Ahh... I'd misinterpreted/misremembered what you'd said at XSLT-UK
about this. Thanks for the clarification. So with Saxon as the
processor, it's worth putting an expression into a variable if it's
(a) likely to be expensive to compute *and* (b) going to be executed
more than three times in the same context.

[Jim: I forgot the other aspect of using variables which is handy,
namely for maintenance it's easier to refer to complicated expressions
than repeat them in the code.]

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]