xsl-list
[Top] [All Lists]

RE: AW: how to "save" a context?

2003-01-21 04:03:23
It would certainly be possible in principle to optimize the execution

of count(preceding::node()), whether it's evaluated during index
construction or later, but I think you'll be lucky to find a
processor
that does it. In general, executing this expression on N nodes will 
have O(N^2) performance. The approach using dynamic evaluation will 
have O(N) performance, so it will win in the end.

I think it's likely that on most documents, counting the number of
preceding-siblings at each level is likely to be significantly more
efficient than counting all preceding nodes. So (for elements at any
rate), why not use

<xsl:number level="multi" count="*"/>

giving an identifier such as 1.3.24.6, which can then be used to 
locate the node using a recursive descent of the tree, using

  child::*[position() = substring-before($nr, '.')]

to select the right node at each level.


Absolutely right.

Based on this isn't it a good idea to have in XSLT/XPath a 
persistent-id() function and from-id() function?

As we see, this will eliminate (I hope almost completely) the need for
the xx:evaluate() extension function. 




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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