Subject: Re: [xsl] bad programming for speedup? From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Tue, 24 Jul 2007 13:04:07 +0100 |
In trying to reverse-engineer your code, it looks to me as if you are doing a classic "group-adjacent" problem, where a group of adjacent row elements are wrapped in a table element. In XSLT 2.0 the most efficient way to do this should be <xsl:for-each-group group-adjacent="boolean(self::row)">. In 1.0 the most efficient would probably be sibling-recursion
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates select="node()[1]"/> </xsl:copy> <xsl:apply-templates select="following-sibling::node()[1]"/> </xsl:template>
<xsl:template match="row"> <table> <xsl:apply-templates select="." mode="copy"/> </table> <xsl:apply-templates select="following-sibling::*[not(self::row)][1]"/> </xsl:template>
<xsl:template match="row" mode="copy"> <xsl:copy-of select="."/> <xsl:apply-templates select="following-sibling::*[1][self::row]" mode="copy"/> </xsl:template>
cheers andrew -- http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] bad programming for speed, Michael Kay | Thread | [xsl] Antwort: RE: [xsl] bad progra, christoph . naber |
Re: [xsl] bad programming for speed, Abel Braaksma | Date | [xsl] Antwort: RE: [xsl] bad progra, christoph . naber |
Month |