[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:function vs. xsl:template
Felix Geller wrote: Hi, > 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. Regards, -- Florent Georges http://www.fgeorges.org/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|