[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: Florent Georges <lists@xxxxxxxxxxxx>
Date: Wed, 19 Nov 2008 14:44:53 +0100 (CET)
Re:  xsl:function vs. xsl:template
Felix Geller wrote:


>    how does the experienced XSLT 2.0 programmer decide on whether
> to use a xsl:function or a (named) xsl:template?

  My rule of thumb, when there is no other way to decide, is to write a
template if it creates new nodes, and a function elsewhere.

  Another point, in favour of functions, is if it has to be used (or if
it is just more convenient) in an XPath expression (for instance
functions that will typically be used within predicates.)

  And a determinant point is when you want to be able to configure the
call in many ways (passing a lot of different parameters) while being
able to have default values for most of them.  Using a named template
provides something similar to the keyword parameters in Lisp.

  But this is far from being strict rules, and this has more to do with
experience and feeling.


Florent Georges

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.