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

Generic Templates (Was: Re: nested templates?)

Subject: Generic Templates (Was: Re: nested templates?)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 18 May 2001 06:36:32 -0700 (PDT)
g binarysearch generics
Jeni Tennison wrote:

> > That is a design flaw. I should be able to do this:
> >
> > <xsl:call-template name="{input/type}" />
> 
> As I pointed out, you probably want to use matching templates rather
> than named ones to achieve this effect.  I guess the reasoning behind
> not allowing you to call templates where you make up the names on the
> fly is that if you make up a name for a template that doesn't exist,
> the stylesheet will fail.  If you know all the names in advance, then
> you can use xsl:choose to choose between them.

As I pointed out in an earlier message 
(http://sources.redhat.com/ml/xsl-list/2001-05/msg00276.html), 
you don't need to know either the template names in advance, or use xsl:choose to
choose between them. There is a technique to dynamically invoke a template that is
unknown and not-yet-written, using a unique match pattern.

Thus, we can have many useful generic templates -- a single generic template that
implements both the min() and max() functions, templates for binary search, generic
sort, etc... These templates are written without knowing in advance what the
"greater-than" or "less-than" or whatever a necessary relation/action is and they
allow the caller to specify dynamically through a parameter the template that
implements this relation/action.

I am attempting to submit some templates (among them 5 generic ) to the EXSLT group
and ***hope*** to succeed soon, because despite the kind help I got from Jim Fuller,
writing the necessary documentation for submitting EXSLT functions is much more
difficult than implementing the functions themselves.

Dimitre Novatchev.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.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.