
xdmp:invoke-function( $func as function(), [$options as (element()|map:map)?] ) as item()*
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
   detailed option information, see
   xdmp:invoke 
    
   for detailed option information. NOTE: Some options require additional
   privileges. For details, see the Required Privileges section of
   xdmp:invoke.
   When expressed as an element, the options node 
    must be in the xdmp:eval namespace.
   | 
	  
http://marklogic.com/xdmp/privileges/xdmp-invoke
Some options require additional privileges. For details, see the Required Privileges for xdmp:invoke.
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.
  xquery version "1.0-ml";
  let $content := <doc/>
  return
    xdmp:invoke-function(
      function() { xdmp:document-insert("doc",$content) },
      <options xmlns="xdmp:eval">
        <update>auto</update>
        <commit>auto</commit>
      </options>)
	
  (: Invokes the function value in an update-auto-commit transaction. :)
  xquery version "1.0-ml";
  let $content := <doc/>
  return
    xdmp:invoke-function(
      function() { xdmp:document-insert("doc",$content), xdmp:commit() },
      <options xmlns="xdmp:eval">
        <update>true</update>
        <commit>explicit</commit>
      </options>)
	
  (: Invokes the function value in a multi-statement update transaction. :)