Loading TOC...

fn.head

fn.head(
   $seq as ValueIterator,
   $arg as ValueIterator
) as String?

Summary

Returns the first item in a sequence. For more details, see XPath 3.0 Functions and Operators.

Parameters
$seq The function value.
$arg A sequence of function values (as a ValueIterator). If you pass in a single value, it is treated as a ValueIterator with that single item; therefore, if you pass in an array, the function will return the array. If you mean to check the values of each item in the array, then you can call xdmp.arrayValues on the array.

Example

fn.head(xdmp.arrayValues([1,2,3]))
=> 1

Comments

  • The return type is `String?`, but in XQuery it is `item()?`. Sounds like a bug to me...
  • What's the second parameter? The F&O spec contains only one arity, and I cannot make sense of the `arg` description above...
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy