xsl-list
[Top] [All Lists]

RE: [xsl] Elements and functions available

2008-10-22 05:49:23
Out of interest, can someone comment on the cost of calling 
these functions?  I imagine element-available() is very 
cheap, but I'm wondering about function-available() with user 
created extensions...

Performance is always processor-dependent. If the argument to
function-available is a literal, then Saxon is going to optimize away
something like

if (function-available('f:x')) then f:x() else ()

at compile time either to a call on f:x() or to ().

On the other hand, with a run-time argument, function-available() in Saxon
is probably very expensive. Much the same applies to element-available,
since Saxon does allow user-written extension elements.

Michael Kay
http://www.saxonica.com/


Given a transform that makes use of many custom extensions, 
is it reasonable to do:

<xsl:choose>
   <xsl:when test="function-available( )">
     normal execution
   </
   <xsl:otherwise>
     test execution

...to allow you to run the transform away from the host application?
Or would all the calls to function-available() adversely 
affect normal running of the transform?

The alternative (and good practice anway I think) is to move 
all of the calls to extensions into one or maybe two physical 
stylesheets, and then you can use an alternative primary 
stylesheet that imports a different stylesheet where the 
calls to the extensions have been replaced with sample values....

Either way, I'm just wondering if I should try to avoid lots of
function-available() calls?



2008/10/22 Jesper Tverskov <jesper(_at_)tverskov(_dot_)dk>:
I have tested the little used XSLT functions element-available() and
function-available() and made a stylesheet that can create a report 
for most XSLT processors, testing also for EXSLT extensions 
and Saxon 
extensions.

I have made 8 reports available and a summary, "Elements 
and functions 
available in XSLT processors", 
http://www.xmlplease.com/elements-functions.

Feel free to suggest improvements.

Best regards,
Jesper Tverskov

http://www.xmlplease.com


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--