Loading TOC...

xdmp:invoke-function

xdmp:invoke-function(
   $func as function(),
   [$options as (element()|map:map)?]
) as item()*

Summary

Returns the result of evaluating an XQuery function value.

Parameters
$func A zero arity function value to execute.
$options Options controlling the evaluation. The default is no options. For xdmp:eval for detailed option information. When expressed as an element, the options node must be in the xdmp:eval namespace.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-invoke

Usage Notes

The XQuery version of this function (xdmp:invoke-function) can only be used to invoke XQuery functions. The Server-Side JavaScript version of this function (xdmp.invokeFunction) can only be used to invoke JavaScript functions.

Example

  xquery version "1.0-ml";
  let $content := <doc/>
  return
    xdmp:invoke-function(
      function() { xdmp:document-insert("doc",$content) },
      <options xmlns="xdmp:eval">
        <transaction-mode>update-auto-commit</transaction-mode>
      </options>)
	
  (: Invokes the function value in an update-auto-commit transaction. :)

Example

  xquery version "1.0-ml";
  let $content := <doc/>
  return
    xdmp:invoke-function(
      function() { xdmp:document-insert("doc",$content), xdmp:commit() },
      <options xmlns="xdmp:eval">
        <transaction-mode>update</transaction-mode>
      </options>)
	
  (: Invokes the function value in a multi-statement update transaction. :)

Comments

  • The first parameter, the function item, is called `$path`. Not really a bug, but not the best naming convention ;-)
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy