[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] tail-recursion


Subject: RE: [xsl] tail-recursion
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2003 16:19:36 +0100

> Your template parseRows is intrinsically tail-recursive - basically
this
> means that after calling itself, it does nothing else before
returning.

Isn't the template head-recursive... it does all of the xsl:value-of 's
as it unwinds from the stack.

I thought if it was tail recursive it would do the value-of first, then
call itself.  




> > <xsl:template name="parseRows">
> > 	<xsl:param name="catContents"/>
> > 	<xsl:param name="font-size" select="'-1'"/>
> > 	<xsl:choose>
> > 		<xsl:when test="contains($catContents,'~!~')">
> > 			<xsl:call-template name="parseRow">
> > 				<xsl:with-param name="rowContents"
> > select="substring-before($catContents,'~!~')"/>
> > 				<xsl:with-param
> > name="font-size" select="$font-size"/>
> > 			</xsl:call-template>
> > 			<xsl:call-template name="parseRows">
> > 				<xsl:with-param name="catContents"
> > select="substring-after($catContents,'~!~')"/>
> > 				<xsl:with-param
> > name="font-size" select="$font-size"/>
> > 			</xsl:call-template>
> > 		</xsl:when>
> > 		<xsl:otherwise>
> > 			<xsl:value-of select="$catContents"/>
> > 		</xsl:otherwise>
> > 	</xsl:choose>
> > </xsl:template>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread