remove

Removes an item from a sequence

Description

The fn:remove function returns a copy of $target with the item at position $position removed. Position numbers start at 1, not 0.

Parameters

Description

target:item()

the sequence to remove an item from

position:integer()

the position to remove the item from

Examples

XPath

Results

remove( ('a', 'b', 'c'), 2)

('a', 'c')

remove( ('a', 'b', 'c'), 10)

('a', 'b', 'c')

remove( ('a', 'b', 'c'), 0)

('a', 'b', 'c')

In a generator

Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-remove.

[e] example-remove
    [e] start
        [e] match
            [v] /
        [e] body
            [e] write-pattern
                [v] examples
    [e] patterns
        [e] examples
            [v] E01: {{ remove( ('a', 'b', 'c'), 2) }}
            [v] E02: {{ remove( ('a', 'b', 'c'), 10) }}
            [v] E03: {{ remove( ('a', 'b', 'c'), 0) }}