[xsl] A question on optimization

Subject: [xsl] A question on optimization
From: Jochen Wiedmann <jochen.wiedmann@xxxxxxxxxx>
Date: Tue, 02 Nov 2004 14:28:43 +0100
Hi,

I have a stylesheet, which processes a *very* large XML document. Basically, the XML document contains a header, which specifies a lot of "columns" (say "a1", "a2", "a3", ..., except, that the names are dynamic). Following that, the stylesheet creates a HTML "table" tag and iterates over the remaining contents of the XML document. For any "row" (some 10000), it creates a "tr" tag similar to the following:

    <xsl:element name="td"><xsl:
      <xsl:attribute name="a1"><xsl:value-of select="@a1"/>
      </xsl:attribute>
      <xsl:attribute name="a2"><xsl:value-of select="@a2"/>
      </xsl:attribute>
      <xsl:attribute name="a3"><xsl:value-of select="@a3"/>
      </xsl:attribute>
    </xsl:element>

The above code works fast. However, due to the dynamic specification of the column names, I have several cascading loops, which seem to slow down the processing seriously.

Do you have any suggestions, how to implement the above very fast? For example, is it possible, to create or modify a template at runtime? Is it possible to at least read the attribute names into some kind of array and iterate over the arrray elements? Or, anything else, ...


Regards,


Jochen


-- http://lilypie.com/baby1/050423/1/5/1/+1

Current Thread