fn:function-arity

Returns the arity of the function identified by a function item.

Signature

fn:function-arity($func as function(*)) as xs:integer

Properties

This function is deterministic, context-independent, focus-independent, and higher-order.

Rules

The fn:function-arity function returns the arity (number of arguments) of the function identified by $func.

Examples

The expression fn:function-arity(fn:substring#2) returns 2.

The expression fn:function-arity(function($node){name($node)}) returns 1.

The expression let $initial := fn:substring(?, 1, 1) return fn:function-arity($initial) returns 1.