[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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) |
Jeni, > > > 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() template?). 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 remainder. 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.: "AB02AC1C-1C65B3FF-77C5FFFE-4B329DA1" Unfortunately, a namespace for a template reference has to be ***globally*** defined as has to be any template. Therefore name clashes are possible. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Find a job, post your resume. http://careers.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: Re: Re: lookup-table , Jeni Tennison | Thread | Re: [xsl] Re: Re: Re: lookup-table , Jeni Tennison |
Re: [xsl] Something like eval()? an, Jeni Tennison | Date | Re: [xsl] Re: lookup-table thoughts, Tom Myers |
Month |