[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Grouping problem?

Subject: Re: Re: Grouping problem?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Wed, 23 Apr 2003 07:00:39 +0200
 Re: Re: Grouping problem?
"Conal Tuohy" <conalt@xxxxxxxxxxxxxxx> wrote in message
news:000c01c30927$86c52f30$d9784fcb@xxxxxxxxxxxxxxxxxxxx
> Hi Lars. I think you're right about the correct definition of the problem.
> So I still didn't have my conditions right.
>
> Here's my 3rd version of the recursive solution, which now produces the
same
> output as Benjamin's.
>
> I would guess that this recursive solution would be quicker (for documents
> larger than a certain size), but on the other hand perhaps it could
produce
> stack-overflow problems on really large documents? As I understand it,
using
> tail-recursion is supposed to allow the XSLT interpreter to optimise the
> recursion by converting to it a loop, without pushing stack frames ... but
I
> don't know how many processors actually implement this? Does anyone know?
Is
> my code below appropriate for this kind of optimisation?
>
>
http://www-106.ibm.com/developerworks/xml/library/x-xslrecur/?dwzone=xml#opt
> 4
> http://info.astrian.net/jargon/terms/t/tail_recursion.html :-)


You can use a DVC (Divide and Conquer) style algorithm here. Split a
node-set into two and recursively solve the problem on them.

Your recursive template must accept some initial accumulated number as a
parameter -- the sum of the last group of elements of the first half will be
passed as this initial accumulation to the template invocation that
processes the second half.

The recursion depth of a DVC algorithm is only log2(N).

http://www.topxml.com/code/default.asp?p=3&id=v20020107050418

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.