Re: [xsl] Optimization using keys

Subject: Re: [xsl] Optimization using keys
From: António Mota <amsmota@xxxxxxxxx>
Date: Wed, 16 Feb 2005 19:53:30 +0000
Curiosly i just did that, in part beacuse i remembered another xslt
where i did that per your sugestion... It improves a little, specially
when running on IDE (Xalan, Saxon653, Saxon81B) but in the browsers
(FF, IE) it improves just a little...

On Wed, 16 Feb 2005 19:47:59 -0000, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> Anything that processes each Menu element by counting how many preceding
> Menu elements there are is going to be slow, in fact it's going to vary as
> the square of the input document size.
> If your requirement is:
> Given a XML with nested Menu structures,
> i want to copy all the nodes to the output tree *except* the one that
> corresponds to the $pos position, wich i want to replace with the
> result from document.
> then what you should do is first identify the node at the Nth position, and
> then when you process each node, test whether it is that one.
> The node at the n'th position is (//Menu)[$pos]
> You can test whether node $A is the same node as $B in XPath 2.0 using ($A
> is $B). In 1.0 you can use generate-id($A)=generate-id($B), or
> count($A|$B)=1.
> Michael Kay

Current Thread