RE: [xep-support] "Filtered" Select and alternating background-color

From: Greg Baryza <baryza@intersystems.com>
Date: Thu May 25 2006 - 09:29:15 PDT

 From the NIST dictionary:

tail recursion
(algorithmic technique)

Definition: A special form of recursion where the last operation of a
function is a recursive call. The recursion may be optimized away by
executing the call in the current stack frame and returning its result
rather than creating a new stack frame.

Substitute "template" for "function" and there you have it. When a
template ends with a direct invocation of itself, the processor can
reinitialize and reuse the stack frame. It doesn't have to push a new one.

At 11:41 AM 5/25/2006, you wrote:
>Hi David,
>
> > tail recursion is optimized into a loop by many XSLT implementations,
>e.g.
> > SAXON and XT; thus the stack does not grow and iterative alogithms are
>as
> > good when represented using recursion as if looping constructs were
>used.
>
>"tail recursion"? Is this a particular type of recursive call in XSLT,
>different from other types?
>
>If I have the following, what's happening on the stack to prevent
>stack-space issues?
>
>
><xsl:template match="ROOT">
> <xsl:apply-templates select="foo[1]"/>
></xsl:template>
>
><xsl:template match="foo">
> <p>Before recursive call...<xsl:value-of
>select="position()"/></p>
>
> <xsl:apply-templates select="following-sibling::foo"/>
>
> <p>After recursive call...<xsl:value-of
>select="position()"/></p>
> ...
> ...
></xsl:template>
>
>
>Doesn't the parser need to keep track of all the matches for <foo>, so
>it can spit out the "After..." stuff? If I have 300,000 <foo> elements
>to process, is there an issue?
>
>- Todd
>
>
>-------------------
>(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
>in the body of the message to majordomo@renderx.com from the address
>you are subscribed from.
>(*) By using the Service, you expressly agree to these Terms of Service
>http://www.renderx.com/terms-of-service.html

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Thu May 25 09:59:43 2006

This archive was generated by hypermail 2.1.8 : Thu May 25 2006 - 09:59:44 PDT