Re: [xslt] key() in match pattern of xsl:key
- From: Vincent Lefevre <vincent+gnome vinc17 org>
- To: xslt gnome org
- Subject: Re: [xslt] key() in match pattern of xsl:key
- Date: Mon, 12 Dec 2005 11:43:38 +0100
On 2005-12-11 14:26:32 -0500, Joel E. Denny wrote:
> To be clear, I'm not concerned with minor performance improvements
> for my current project. On the other hand, I did try replacing the
> referenced key() with an EXSLT user function. Assuming a key is
> implemented as a hash, this changes the (one time) referencing key
> computation from O(n) to O(n^2). That is, the EXSLT user function
> has to re-search the entire document upon every invocation whereas
> the referenced key() may be constant time. For large XML input, I'm
> not sure that's going to cut it with any XML processor.
I haven't looked at your specific problem, but I think that *some*
O(n^2) -> O(n) optimizations can be done with two passes, by storing
a temporary RTF, that could be used as a nodeset in the second pass.
With XSLT 1.0, this solution really needs two passes, by calling the
XSLT processor twice, but with EXSLT, you can use the function that
converts a RTF into a nodeset.
Vincent Lefèvre <vincent vinc17 org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
] [Thread Prev