You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Howard Ungar <ho...@yahoo.com> on 2002/05/11 16:25:18 UTC

slow performance with recursive templates

I am having very slow performance (40 seconds) with xalan when
processing a template with recursive calls.  The same template runs
quickly (2-3 seconds) in several other transform engines I've tried
(saxon, stylus studio, msxml).  Is there a known performance problem
with recursive templates in xalan?  Here is the recursive template
which gets called a bunch of times (100) by other templates in my
stylsheet:

	<!-- sumUnits - Recursively call to sum the units -->
	<xsl:template name="sumUnits">
		<xsl:param name="groupRows"/>
		<xsl:param name="gatherRows"/>
		<xsl:choose>
			<xsl:when test="$groupRows">
				<xsl:variable name="first" select="$groupRows[1]"/>
				<xsl:variable name="total">
					<xsl:call-template name="sumUnits">
						<xsl:with-param name="groupRows"
select="$groupRows[position()!=1]"/>
						<xsl:with-param name="gatherRows" select="$gatherRows"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="gatherUnits"
select="$gatherRows[REPTS=$first/REPTS and ENTITY=$first/ENTITY and
PMCASE=$first/PMCASE]/NUMUNITS"/>
				<xsl:choose>
					<xsl:when test="$gatherUnits &gt; 0">
						<xsl:value-of select="$total + $gatherUnits"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$total + $first/NOUNITS"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>0</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com