xsl-list
[Top] [All Lists]

Re: [xsl] xsl:function vs. xsl:template

2008-11-19 08:06:36
I tend to use functions to return values, and named templates to add
nodes to the result tree... but sometimes just use a function anyway
because the calling code is less verbose.



2008/11/19 Felix Geller <fgeller(_at_)gmail(_dot_)com>:
Hi all,

  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)?

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.


cheers

-- Felix

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>