Returns an external object intended for use as a member of a newly constructed array.

array-member($value as item()*) ➔ jt:com.saxonica.functions.extfn.ArrayMemberValue





The value to be used as an array member




Notes on the Saxon implementation

Available since Saxon 9.8.


This function can be used to assist in constructing arrays whose members are sequences rather than individual items.

For example, the expression array { (1 to $n) ! saxon:array-member(1 to $n) } (with $n = 4) constructs the array array{1, (1, 2), (1, 2, 3), (1, 2, 3, 4)}. Without this construct, there is no convenient way of constructing an array where (a) the number of members is not known statically, and (b) the members may be arbitrary sequences rather than single items.

The actual result of the function is an external object which is specially recognized by the internal function array:_fromSequence which underpins the XPath curly array constructor array{a, b, c} and also the extension instruction saxon:array. If this internal function recognizes an instance of com.saxonica.functions.extfn.ArrayMemberValue in its input sequence, then instead of adding it to the array as a member directly, it unwraps it to obtain the underlying sequence, and adds this sequence as the next member of the array.