Loading TOC...

fn:function-lookup

fn:function-lookup(
   $name as xs:QName,
   $arity as xs:integer
) 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

let $fn := fn:function-lookup(fn:QName("http://www.w3.org/2005/xpath-functions","concat"),4)
return
  xdmp:function-signature($fn)
=> "function(xs:anyAtomicType?, xs:anyAtomicType?, xs:anyAtomicType?, xs:anyAtomicType?) as xs:string"

Example

let $fn := fn:function-lookup(
  fn:QName("http://www.w3.org/2005/xpath-functions","concat"),4)
return
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.