RE: XSLT 2.0: function-available() for stylesheet functions

> the 2.0 spec says that function-available() can be used to 
> test for the
> existence of functions defined with xsl:function.
> 
> I always thought that the function-available() and element-available()
> functions are there to inquire properties of the 
> *implementation*. I think
> it's a bad idea to mix this purpose with the inquiry of 
> properties of the *program*.
> 
I don't think function-available() is especially useful in conjunction with
stylesheet-defined functions (because the user knows statically whether the
function exists or not). On the other hand, it either has to return true or
false when the argument is the name of a stylesheet-defined function, and it
seems more logical to return true.

I agree this means that the processor potentially has to keep a list of
function names available at run-time. However, it only has to do this in the
rare event that the stylesheet actually contains a call to
function-available() with an argument that isn't known statically. I would
prefer to place this burden on implementations, rather than returning the
surprising result of "false" when the user tests whether a stylesheet
function is available.

Michael Kay 

Received on Monday, 15 April 2002 10:47:35 UTC