Loading TOC...

xdmp:invoke-function

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

Summary

Returns the result of evaluating a function value.

Parameters
path A zero arity function value to execute.
options The options node. The default value is (). The node must be in the xdmp:eval namespace. See the xdmp:eval section for a list of options.

Required Privileges

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

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. 

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