Loading TOC...

fn.functionLookup

fn.functionLookup(
   $name as xs.QName,
   $arity as Number
) as function(*)?

Summary

Returns a function with the given name and arity, or the empty sequence if none exists. You can use the returned function reference with xdmp.apply. For more details, see XPath 3.0 Functions and Operators.

Parameters
$name The QName of the function.
$arity The number of arguments the function takes.

Example

var fn = fn.functionLookup(
           fn.QName('http://www.w3.org/2005/xpath-functions','concat'),4);
xdmp.functionSignature(fn);
=> 'function(xs:anyAtomicType?, xs:anyAtomicType?, xs:anyAtomicType?, xs:anyAtomicType?) as xs:string'

Example

var fn = fn.functionLookup(
           fn.QName('http://www.w3.org/2005/xpath-functions','concat'),4);
xdmp.apply(fn, 'here', 'is', 'an', 'example');
==> 'hereisanexample'

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.