Re: [xslt] Tail-call optimization for call-template possible?



On 26/07/2010 15:58, Nikolai Weibull wrote:
Hi!

I’m using XSL-T for the parsing escaped HTML inside XML.  Yes,
terrible, I know, but it’s the best I can do.

Anyway, I’m currently running out of stack space when trying to parse
longer strings and was wondering if anyone had actually considered
“tail-call optimizing” call-template to avoid running out of stack.
How much work would it be?

I once had a look at it and I'd consider it a lot of work. The libxslt code uses indirect recursion over three or four functions. It's not trivial to convert them all to tail calls. Alternatively, one could use trampolines. But that looks pretty complicated, too.

On my Cygwin installation the following script works, but changing the
test to 5175 causes a silent exit.

I'd suggest to have a look at the EXSLT string functions. Maybe you can solve your problem with them without using recursive template calls.

Nick


--
aevum gmbh
rumfordstr. 4
80469 münchen
germany

tel: +49 89 3838 0653
http://aevum.de/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]