Re: [xsl] Re: Re: Re: lookup-table thoughts (was Re: matching multiple times, outputting once?

Subject: Re: [xsl] Re: Re: Re: lookup-table thoughts (was Re: matching multiple times, outputting once?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 7 Nov 2001 07:57:58 -0800 (PST)

> > Obviously Jeni's reflection of me needs updating...
> Aww... I thought you'd like the divide-and-conquer stuff :)

Hmm... Your example was not exactly the classical divide and conquer by dividing by
2, but a variation of my flexible allocation algorithm (remember the repeat()

In this case it outperforms the "classical" DVC, one gets a maximum call stack depth
of 6 as opposed to 10. However, in the worst-case scenario, when the number of times
must be not 1000 but a big prime number, the strict division scheme will perform
identically to simple one-by-one recursion, whereas the "classical" DVC will still
have log2(p) recursive complexity. This can be corrected by allowing division with

Anyway, thanks so much for imitating the style of the repeat() template -- I could
not stop laughing for a long time...

> > As you can notice, the "buildListWhile" function (oopsss...
> > template) is generic enough to incorporate any future
> > indoctrinations. Actually its real purpose is to help in simulating
> > Haskell's lazy evaluation of infinite data structures, and
> > especially to be used in implementing the "take", takeWhile" etc.
> > family of Haskell functions.
> Cool. Could you post the buildListWhile template so we can see how it
> works?

I hope very soon to be able to provide a link to a complete article, which contains
much more than just the buildListWhile template.

> By the way, out of interest, in:
> >   <xsl:template name="listGenerator" match="*[namespace-uri()='pGenerator']">
> [snip]
> >   </xsl:template>
> is there any particular reason why you're testing the namespace URI
> rather than using match="pGenerator:*"?

Simply to avoid name clashes with templates from other stylesheets -- they are very
probable with names, very difficult to debug, and can be completely avoided with
namespace-uri's generated by a GUID generating tool, e.g.:


Unfortunately, a namespace for a template reference has to be ***globally*** defined
as has to be any template. Therefore name clashes are possible.

Dimitre Novatchev.

Do You Yahoo!?
Find a job, post your resume.

 XSL-List info and archive:

Current Thread