Subject: RE: What's your visual metaphor for XSL Transformations?
From: "W Charlton" <XSLList@xxxxxxxxxx>
Date: Thu, 22 Mar 2007 08:47:30 -0000
|
Kamal wrote
Snip--
"this is what I think of when I think of recursion". In the past I would
often draw circles in the air when I was trying to deal with a recursive
problem, which reminds me of Ouroboros.
Snip--
I see your point. Ouroboros is more easily applied to politicians; they just
don't know when to stop! Stopping in recursive templates is essential.
Continuing on my ant/aphid analogy.
I see recursion as the task one ant has to milk all the aphids.
<xsl:for-each select="Branch">
<xsl:call-template name="MilkAphid">
<xsl:with-param name="pUnmilkedAphid"
select="count(Aphid/AphidMilk)"/>
</xsl:call-template>
</xsl:for-each>
<xsl:template name="MilkAphid">
<xsl:param name="pUnmilkedAphids"/>
<xsl:choose>
<xsl:when test="not(pUnmilkedAphids) or $pUnmilkedAphids =
'' "/>
<xsl:when test="$pUnmilkedAphids > 0">
<xsl:value-of select="Aphid/AphidMilk"/>
<xsl:call-template name="MilkAphid">
<xsl:with-param name="pUnmilkedAphid"
select="$pUnmilkedAphids - 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
Sooner or later analogies break down, but it IS Friday:)
William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net
--~--
| Current Thread |
Kamal Bhatt - 22 Mar 2007 04:10:37 -0000
- W Charlton - 22 Mar 2007 08:48:02 -0000 <=
|
|