Loading TOC...

fn:remove

fn:remove(
   $target as item()*,
   $position as xs:integer
) as item()*

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.
position The position in the target sequence from which the items will be removed.

Example

let $x := ("a", "b", "c")
return
fn:remove($x, 0) returns ("a", "b", "c")

let $x := ("a", "b", "c")
return
fn:remove($x, 1) returns ("b", "c")

let $x := ("a", "b", "c")
return
fn:remove($x, 6) returns ("a", "b", "c")

let $x := ("a", "b", "c")
return
fn:remove((), 3) returns ()

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