ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
Re: [xsl] Re: Re: Re: lookup-table thoughts (was Re: matching multiple times, outputting once?
by Dimitre Novatchev other posts by this author
Nov 7 2001 3:57PM messages near this date
Re: [xsl] Re: Re: Re: lookup-table thoughts (was Re: matching multiple times, outputting once? | Re: [xsl] Re: Re: Re: lookup-table thoughts (was Re: matching multiple times, outputting once?
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
Thread:
Dimitre Novatchev
Jeni Tennison
Dimitre Novatchev
David Carlisle
Jeni Tennison

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved