PyXdmFunctionItem

class PyXdmFunctionItem

Bases: PyXdmItem

The class PyXdmFunctionItem represents a function item

arity

Get the arity of the function

Returns:

The arity of the function, that is, the number of arguments in the function’s signature

Return type:

int

call(args)

Call the function

Parameters:

args (list) – the values to be supplied as arguments to the function. The “function conversion rules” will be applied to convert the arguments to the required type when necessary.

Returns:

the result of calling the function

Return type:

PyXdmValue

static get_system_function(proc, name, arity, encoding=None)

Get a system function. This can be any function defined in XPath 3.1 functions and operators, including functions in the math, map, and array namespaces. It can also be a Saxon extension function, provided a licensed Processor is used.

Parameters:
  • proc (PySaxonProcessor) – the Saxon processor

  • name (str) – the name of the requested function as an EQName or clark name

  • arity (int) – the arity of the requested function

  • encoding (str) – the encoding of the name string. If not specified then the platform default encoding is used.

Returns:

the requested function

Return type:

PyXdmFunctionItem

name

Get the name of the function

Returns:

The name of the function as an EQName

Return type:

str

string_value

Property to get the string value of the PyXdmFunctionItem. This will always raise an Exception, as function items have no representation as a string value (FOTY0014).

Raises:

PySaxonApiError – function items have no representation as a string value