RE: [xsl] use-when attribute?

Subject: RE: [xsl] use-when attribute?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 18 Dec 2004 14:07:59 -0000
> 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...


Saxon builds the index for each key when that key is first used against a
particular document. In general, you don't know which keys will be used for
which document, and there's no point building an index for a key that won't
be used.

In any case, scanning the nodes is not expensive compared with evaluating
the pattern and the use expression, so it doesn't much matter whether it's
done in one scan or several. It's not like a database, where disc accesses
are expensive and need to me minimised.

Also, forming the union of three node-sets isn't necessarily expensive in a
pipelined implementation, especially if the path expressions that produce
the three node-sets automatically deliver results in sorted order. (This is
another reason for avoiding // - an expression of the form //a/b may need to
be sorted, whereas /*/a/b doesn't).

Michael Kay
http://www.saxonica.com/

Current Thread