Subject: RE: 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 |
- tail-recursion
- I-Lin Kuo - Thu, 28 Aug 2003 09:44:12 -0400 (EDT)
- <Possible follow-ups>
- Andrew Welch - Thu, 28 Aug 2003 11:19:45 -0400 (EDT) <=
- I-Lin Kuo - Thu, 28 Aug 2003 11:22:12 -0400 (EDT)
- Andrew Welch - Thu, 28 Aug 2003 11:23:07 -0400 (EDT)
|
|