xsl-list
[Top] [All Lists]

Re: recursion with xsl:apply-templates

2003-08-27 08:38:34
Thanks for the hint, I'll work on the perfomance then and give your previous recommendation a closer look.

Andrew Welch wrote:

  <xsl:template match="*[(_at_)index]">
    <xsl:copy>
      <xsl:copy-of select="@*[not(name()='index')]"/>
      <xsl:variable name="p" select="count(preceding::*[(_at_)index])+1"/>


This is fine if it does what you need, but you should be aware that
using the preceding::* axis in this way leads to O(n^2) performance.

It's much better practise to store the data you need in a nodeset, and
then query that.  This means you will do one pass for the nodeset, and
one pass for the data regardless of the number of elements in your
source.

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


--
Mit freundlichen Grüßen / With kind regards
Volker Witzel
____________________________________________
IBM Business Consulting Services
Karl-Arnold-Platz 1a, D-40474 Düsseldorf
fon (0211) 476-1924 (intern *129-1924)
mobil 0172-73 66 586
mail vwitzel(_at_)de(_dot_)ibm(_dot_)com


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



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