xsl-list
[Top] [All Lists]

Re: Optimization using keys

2005-02-16 12:59:27
BTW, is it correct to assume that

<xsl:copy-of select="*"/>

is faster than

<xsl:apply-templates select="*"/> ?


On Wed, 16 Feb 2005 19:53:30 +0000, António Mota <amsmota(_at_)gmail(_dot_)com> 
wrote:
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(_at_)saxonica(_dot_)com> 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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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