RE: ORA-XS-370-B: Signature of function-available()

> 
> SECTION 18.1.1: Testing Availability of Functions
> 
> Shouldn't we add an optional argument (type of integer) to 
> function-available() indicating the value of arity? 
> User-defined functions may have same name but different 
> arity. If the check is only based on name, 
> function-available() may return true, when it should be false.
> 

The XSL Working Group decided on 19 Feb 2004 to accept this proposal.

Here is the proposed revised text of section 16.1.1. I would be grateful
if you would confirm that this is acceptable.

16.1.1 Testing Availability of Functions
The function-available function can be used with the xsl:choose and
xsl:if instructions to explicitly control how a stylesheet behaves if a
particular extension function is not available.

function-available($function-name as xs:string) as xs:boolean

function-available( $function-name  as xs:string, 
$arity  as xs:integer) as xs:boolean 

A function is said to be available within an XPath expression if it is
present in the in-scope functions for that expression (see
[static-context]). Functions in the static context are uniquely
identified by the name of the function (a QName) in combination with its
arity.

The value of the $function-name argument must be a string containing a
lexical QName. The lexical QName is expanded into an expanded-QName
using the namespace declarations in scope for the expression. If the
lexical QName is unprefixed, then the standard function namespace is
used in the expanded QName.

The two-argument version of the function-available function returns true
if and only if there is an available function whose name matches the
value of the $function-name argument and whose arity matches the value
of the $arity argument. 

The single-argument version of the function-available function returns
true if and only if there is at least one available function (with some
arity) whose name matches the value of the $function-name argument. 

[ERR XT1400] It is a recoverable dynamic error if the argument does not
evaluate to a string that is a valid QName, or if there is no namespace
declaration in scope for the prefix of the QName. The optional recovery
action is to return the value false. If the processor is able to detect
the error statically (for example, when the argument is supplied as a
string literal), then the processor may optionally signal this as a
static error. 

Note:

The fact that a function with a given name is available gives no
guarantee that any particular call on the function will be successful.
For example, it is not possible to determine the types of the arguments
expected.

[ERR XT1410] It is a non-recoverable dynamic error if a FunctionCallXP
within an XPath expression is evaluated, when the function in question
is not available. An implementation must not signal a static error
merely because an expression contains a call to an extension function
for which no implementation is available.

Regards,

Michael Kay

Received on Thursday, 19 February 2004 19:13:57 UTC