fn:subsequence

Return subsequence of a sequence.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:subsequence(sequence $sequence, double $start) => sequence
fn:subsequence(sequence $sequence, double $start, double $length) => sequence

Description

This function returns a subsequence of $sequence, which begins at $start and contains the next $length entries, if a third parameter is provided.

Argument

$sequence

sequence

$start

double value: the position at which the subsequence starts

$length

double value: the length of the subsequence

Examples

  • Return all entries starting from the 5th:

    let $seq := (1,2,3,4,5,6,7)
    return subsequence($seq,5)

    This returns (5,6,7).

  • Return three entries starting from the 2nd:

    let $seq := (1,2,3,4,5,6,7)
    return subsequence($seq,2,3)

    This returns (2,3,4).