Re: [xsl] Recursive Template ??

Subject: Re: [xsl] Recursive Template ??
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 5 Jun 2005 07:41:44 +1000
On 6/3/05, Bovy, Stephen J <STEPHEN.Bovy@xxxxxx> wrote:
> Thanks every-one !!
>
> Does it incur a heavy performance penalty ???

Compared to what?

For some problems it may be very difficult (if at all possible) to
have a non-recursive solution.

Also, often the non-recursive solution (if such exists) is much more
complex than the recursive one, more difficult to maintain and its
correctness more difficult to prove.

Why is this so? The answer is that the object on which an XSLT
transformation operates is the tree. A tree is a recursive structure,
having a recursive definition. Not surprisingly, recursion happens to
be a natural technique for processing recursive structures.

There are ways of writing recursive templates and functions that do
not incur *heavy* performance penalty (if any at all), such as:

    DVC (divide and conquer) and

    Tail Recursion.


Cheers,
Dimitre Novatchev

Current Thread