[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Optimization using keys
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 > http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|