Re: [xsl] Is xsl:for-each "syntactic sugar"?

Subject: Re: [xsl] Is xsl:for-each "syntactic sugar"?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 6 May 2010 18:49:56 -0700
> 4. Favor recursive functions over xsl:for-each. (True or False)

No, Always choose iterative processing over recursion, if this is
possible. You may gain significant efficiency this way.

Only a few XSLT processors recognize and optimize tail-recursion and
each of them has its own unique "definition" of what tail-recursion is
(it would be good if the corresponding WGs provide a clear definition
and test cases, so that developers who are willing to optimize tail
recursion do exactly the same thing).

Writing  DVC recursive code is not always easy (e.g. try to write an
LR parser that way...), so it's best choosing iterative processing,
whenever this is possible.


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play



On Thu, May 6, 2010 at 4:02 PM, Costello, Roger L. <costello@xxxxxxxxx>
wrote:
> Hi Folks,
>
> 1. Everything that can be done using xsl:for-each can be done using a
recursive function. (True or False)
>
> 2. There are things that can be done using a recursive function that cannot
be done using xsl:for-each. (True or False)
>
> 3. xsl:for-each is syntactic sugar. (True or False)
>
> 4. Favor recursive functions over xsl:for-each. (True or False)
>
> /Roger

Current Thread