[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] recursion with xsl:apply-templates


Subject: Re: [xsl] recursion with xsl:apply-templates
From: Volker Witzel <volker.witzel@xxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 17:38:34 +0200

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="*[@index]">
    <xsl:copy>
      <xsl:copy-of select="@*[not(name()='index')]"/>
      <xsl:variable name="p" select="count(preceding::*[@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@xxxxxxxxxx


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




Current Thread