Loading TOC...

es:extract-array

es:extract-array(
   $source-nodes as item()*,
   $fn as function(*)
) as json:array?

Summary

This function is deprecated and will not be supported in MarkLogic 11.
Convert one or more source nodes into an array by invoking a function on each of the elements. This is a utility function used by the code generated by Entity Services.

Parameters
$source-nodes The nodes to be converted into array values.
$fn A function reference. The function is applied to each value to be inserted into the array.

See Also

Example

xquery version "1.0-ml";
import module namespace es = "http://marklogic.com/entity-services"
    at "/MarkLogic/entity-services/entity-services.xqy";

let $nodes := (
  <data>1</data>,
  <data>2</data>
)
return es:extract-array($nodes, fn:data#1)

(: Returns the following JSON array: ["1", "2"] :)
  

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