Implementing recursion (Was Re: Char node-type)

Subject: Implementing recursion (Was Re: Char node-type)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 23 Nov 2000 20:21:19 -0800 (PST)
Will it not be simpler just to use SAXON -- it recognises tail
recursion and implements it using iteration -- therefore no stack
overflow will occur.

A month ago I performed a test how SAXON and MSXML 3 (Sep.) perform
highly recursive transformations. 

MSXML performed OK at recursion depth of 1000, but was somewhat slow.
It crashed at recursion depth of 2000.

Saxon 5.4 performed fast and reliably. It took 6 sec. (on a local
computer -- 350MHz, 64MB RAM) for processing the example with recursion
depth of 2000.

In my opinion there must be some requirements in the standard
specifications about the minimum expected robustness and reliability of
an XSLT processor. A good and necessary requirement of this type is
that an XSLT processor should not crash in typical recursive

Unless there's such guarantee it would be extremely difficult (if
possible at all) to commit to using XSLT in "industrial-scale

Dimitre Novatchev.

Richard Light wrote:

In message <002501c05565$e5804320$7e0aa8c0@xxxxxxx>, Dave Hartnoll
<Dave_Hartnoll@xxxxxxx> writes
>I have an idea that will alleviate your depth of recursion problem,
but as
>I'm a relative newcomer to XSL, so I'm not fluent enough to express
>idea in XSL itself yet.
>The idea is that your character processing template should first check
>length of it's string. When it's exactly 1 then process the character
as you
>do now. Otherwise, call yourself recursively, once for the 1st half of
>string, then again for the 2nd half.

That's a thought.  What I have actually done for now is to split the
string on word boundaries (i.e. spaces), which reduces the load on the
stack too.  The problem with a 'binary chop' technique is that one
we need to do is to combine 'character-plus-Unicode-combining-
character(s)' sequences into an image representing the single combined
character.  The chop could split them, unless it looked about for
before deciding exactly where to split the string.


Richard Light
SGML/XML and Museum Information Consultancy

 XSL-List info and archive:

Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.

 XSL-List info and archive:

Current Thread