You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Cory Isaacson/CompuFlex <ci...@compuflex.com> on 2000/03/20 18:26:47 UTC

Performance

I have a stylesheet which is working very well to do what I want it to. It takes some XML data and creates SQL statements on the fly.  The XML document has two sections: 1) A definition section containing info about the target database columns, and 2) the data itself.  The XML document is in a DOM, as I create it on the fly.  

The first time I run it its painfully slow (sometimes up to a minute), and then on subsequent times its subsecond.  I know the serialization of the XSL still has problems, but any other ideas as to how I can speed it up?

Here is a sample of the XSL logic I am using:

<!-- SQL Insert Template. -->
<xsl:template name="BUILD_INSERTSQL">

  <!-- Build INSERT INTO segment. -->
  <xsl:text>INSERT INTO </xsl:text><xsl:value-of select="$tableToUpdate"/><xsl:text> (
</xsl:text>  
  
  <!-- Build Column Name list. -->
  <xsl:for-each select="./COLUMN">
      <xsl:variable name="colIdx"><xsl:value-of select="./@INDEX"/></xsl:variable>
      <xsl:value-of select="/SQLDATASTORE/SQLDEF/COLUMNDEFS/COLUMNDEF[@INDEX=$colIdx]/@NAME"/>
      <xsl:if test="not(position()=last())">, </xsl:if>
    </xsl:for-each><xsl:text> )
VALUES (
</xsl:text>

  <!-- Build Value list. -->
  <xsl:for-each select="./COLUMN">
      <xsl:variable name="colIdx"><xsl:value-of select="./@INDEX"/></xsl:variable>
      <!-- Print SQL values. -->
      <xsl:call-template name="PRINT_SQL_VALUE">
        <xsl:with-param name="colValue">
          <xsl:value-of select="."/>
        </xsl:with-param>
        <xsl:with-param name="dataType">
          <xsl:value-of select="/SQLDATASTORE/SQLDEF/COLUMNDEFS/COLUMNDEF[@INDEX=$colIdx]/@DATATYPE"/>
        </xsl:with-param>  
      </xsl:call-template>  
      <xsl:if test="not(position()=last())">, </xsl:if>
  </xsl:for-each>
  <xsl:text> )
;  
</xsl:text>  

</xsl:template>

Thanks for any help you can lend.

Cory