xsl:array
Experimental: proposed new XSLT 4.0 instruction. Constructs an array, whose content is established using the contained sequence constructor.
Category: instruction
Content: sequence-constructor
Permitted parent elements:
any XSLT element whose content model is
sequence-constructor; any literal result element
Attributes
|
| The contents of the array may be given either by an
expression in the |
|
| If this attribute is present with the
value "yes", then the contained sequence constructor must deliver a sequence of parcels
(items of type |
Saxon availability
Available in the XSLT 4.0 proposal. Requires Saxon-PE or Saxon-EE. Implemented experimentally since Saxon 11. Available for all platforms.
Notes on the Saxon implementation
Available from Saxon 11; requires syntax extensions to be enabled. Also available in earlier releases under the synonym saxon:array.
Details
If every member of the array is to be a singleton item, then it is simplest to use
the default value composite="no"
. The setting composite="yes"
is needed if any of the members is to be an empty sequence, or a sequence containing
multiple items. (Note that when constructing an array destined for serialization as JSON,
the members of the array will always contain either a single item, or be empty. Empty members
translate to the JSON value null
.)
With composite="yes"
, the array members can conveniently be constructed
using the xsl:array-member
instruction. In fact, the following constructions are all equivalent:
A type error occurs if composite="yes"
is used and there are items in the sequence that
do not match the item type record(value, *)
(that is, a map having an entry whose key is the
string "value"). Any other entries in the map are ignored.
For more information, see Creating arrays.