xsl-list
[Top] [All Lists]

RE: [xsl] What's your visual metaphor for XSL Transformations?

2007-03-22 01:48:01
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 &gt; 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
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--