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

Treat any template as a function

Subject: Treat any template as a function
From: Brian Smith <blsmith@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2001 20:32:17 -0600
functions of the brian
I am using the EXSLT Function module a lot. But, I'm wondering why it is necessary. Why can't XSLT processors allow users to call templates using normal function notation. Is this something that is planned for XSLT 2.0? Personally, I don't see any obvious value in distinguishing between functions and templates (a template is just a function that returns an RTF, and an RTF is just a special type of node-set).

For example, the following two stylesheet fragments should, IMO, be equivilent, given a template like this:
...
<xsl:template name='bls:my-template'>
<xsl:param name='param1'/>
<xsl:param name='param2'/>
</xsl:template>
...


(1)
   ...
   <xsl:variable name='var'>
     <xsl:call-template name='bls:my-template'>
       <xsl:with-param name='param1' select='...'/>
       <xsl:with-param name='param2' select='...'/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:value-of select='$var/*'/>
   ...
(2):
   ...
   <xsl:value-of select='bls:my-template(param1, param2)'/>
   ...

Along similar lines, has anybody written a stylesheet that can do these transformations on a stylesheet:
1. Transform all named templates (without match patterns)
into EXSLT functions?
2. Transform all <call-template> elements that call these
functions into <xsl:value-of> elements that cal them?


Thanks,
Brian


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.