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

Re: Re: Re: Re: lookup-table thoughts (was Re: matchin

Subject: Re: 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)
log2 lookup table
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

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.