You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Holger Floerke <fl...@doctronic.de> on 2002/03/27 16:09:48 UTC
Transforming memory grows (Xalan-C)
I have a complex stylesheet using a small input (2MB) to generate a bigger
(but not so big) output (20MB). Applying this Stylesheet allocates 260MB of
memory. I found most of the memory can be saved, if I use a special form of
"xsl:with-param".
Take *big* XML-Document an apply with testXSLT the stylesheet appended.
If I use
<xsl:with-param name="arg1">
<xsl:value-of select="substring(.,2)"/>
</xsl:with-param>
to pass the parameter the memory grows while transorming.
If I use
<xsl:with-param name="arg1" select="substring(.,2)"/>
the memory does not grow.
Is this a general problem? The Stylesheet still uses 80MB of memory.
HolgeR
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:call-template name="foo">
<!-- no memory grow
<xsl:with-param name="arg1" select="substring(.,2)"/>
-->
<!-- memory grow -->
<xsl:with-param name="arg1">
<xsl:value-of select="substring(.,2)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template name="foo">
<xsl:param name="arg1"/>
<xsl:value-of select="$arg1"/>
</xsl:template>
<xsl:template match="text()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
--
holger floerke d o c t r o n i c
email floerke@doctronic.de information publishing + retrieval
phone +49 2222 9292 90 http://www.doctronic.de