[xsl] bad programming for speedup?

Subject: [xsl] bad programming for speedup?
From: christoph.naber@xxxxxxxxxxxxxxxxxxx
Date: Tue, 24 Jul 2007 12:02:18 +0200
Hello everybody,

I'm new to this list, so let me introduce myself:
My name is Christoph Naber. I come from Germany and work with XML/XSL for
about 2 years now.

I'd be pleased to hear your opinion about a stylesheet I've written.

The aim is to surround occurences of <row> - tags with a <table> - tag.
I've done this with "good" XSL, what appears to be real slow, and with a
"bad" version, which inserts tags as <xsl:text>.

The second version:
<xsl:template match="row" >
        <xsl:if test="name(preceding-sibling::*[1]) != 'row'">
                <xsl:text
disable-output-escaping="yes"><![CDATA[<table>]]></xsl:text>
        </xsl:if>
        <xsl:text>
</xsl:text>
        <xsl:copy>
                <xsl:copy-of select="@*" />
                <xsl:apply-templates select="*" />
        </xsl:copy>

        <xsl:if test="name(following-sibling::*[1]) != 'row'">
                <xsl:text
disable-output-escaping="yes"><![CDATA[</table>]]></xsl:text>
        </xsl:if>
</xsl:template>


This solution is much faster, but it makes use of bad XSL programming.

What are you thinking, is it allowed to discard the rules of good
programming for speed-up desires?

Christoph Naber


If you are not the intended addressee, please inform us immediately that you
have received this e-mail by mistake and delete it. We thank you for your
support.

Current Thread