This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Testing if something is not there
- To: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- Subject: Re: [xsl] Testing if something is not there
- From: Jeni Tennison <jeni at jenitennison dot com>
- Date: Tue, 6 Nov 2001 15:50:04 +0000
- CC: xsl-list at lists dot mulberrytech dot com, "'Miller, James V (CRD)'" <millerjv at crd dot ge dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <000301c166d8$6b8e1fd0$26816bd5@pcukmka>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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