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

RE: xsl:function vs. xsl:template

Subject: RE: xsl:function vs. xsl:template
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 19 Nov 2008 19:44:51 -0000
RE:  xsl:function vs. xsl:template
>    how does the experienced XSLT 2.0 programmer decide on 
> whether to use a xsl:function or a (named) xsl:template? Are 
> any performance issues involved (the processor I'm using is Saxon)?

Others have commented on usability aspects, and I agree entirely with what
they say.

As to performance, the Saxon implementation is probably optimized to support
that usage pattern.

In general, function calls in Saxon are more highly optimized than template
calls. For example, Saxon-SA will move the body of a function inline in some
circumstances, reducing the call overhead to zero and giving the opportunity
for further optimizations.

Michael Kay
> When trying to comprehend a stylesheet, I find it easier if 
> the control-flow is managed by explicit function calls.
> Using functions imposes the additional "burden" of passing 
> the node to work on, when compared to xsl:call-template. 
> However, passing the node brings the benefit of making the 
> "context" explicit.
> Being able to use a function in XPath expression also offers 
> a less verbose invocation of functionality.
> What are other benefits/shortcomings of either side? I 
> haven't found any documentation on this issue but would 
> appreciate any hints as to where to find some.

Current Thread


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.
First Name
Last Name
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.