Loading TOC...

fn.remove

fn.remove(
   $target as ValueIterator,
   $position as Number
) as ValueIterator

Summary

Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed.

If $position is less than 1 or greater than the number of items in $target, $target is returned. Otherwise, the value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $target whose index is greater than $position. If $target is the empty sequence, the empty sequence is returned.

For detailed type semantics, see Section 7.2.11 The fn:remove function[FS].

Parameters
$target The sequence of items from which items will be removed. 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 array is treated as a single value (not as one value for each item in the array). If you mean to pass in the values of each item in the array, then you can call xdmp.arrayValues on the array.
$position The position in the target sequence from which the items will be removed.

Example

var x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 0);
=> ("a", "b", "c")

var x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 1);
=> ("b", "c")

var x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 6);
=> ("a", "b", "c")

var x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(null, 3);
=> ()

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy