Used to define the merge keys on which the input sequences of a merging operation are sorted.

Content: sequence-constructor
Permitted parent elements: xsl:merge-source




The merge key can be defined either by a string expression in a select attribute, or by an enclosed sequence constructor.


{ language }

Declares the algorithm used for alphabetic collating, as an ISO language code such as en (English) or de (German). The default is based on the Java system locale.


{ "ascending" | "descending" }

Declares the sort order; the default is ascending.


{ uri }

Declares the collation, by the name of a collating sequence.


{ "upper-first" | "lower-first" }

Relevant only for data-type="text"; it declares whether uppercase letters are sorted before their lowercase equivalents, or vice-versa.


{ "text" | "number" | eqname }

Declares whether collating is based on alphabetic sequence or numeric sequence. The permitted values are either text or number, or a built-in type in XML Schema, such as xs:date or xs:decimal.

Saxon availability

Available in XSLT 3.0. From Saxon 9.8, available in all editions. Implemented in Saxon-PE and Saxon-EE since Saxon 9.6. Available for all platforms.


The syntax and semantics of an xsl:merge-key element are closely based on the rules for the xsl:sort element (the only exception being the absence of the stable attribute); the difference is that xsl:merge-key elements do not cause a sort to take place, they merely declare the existing sort order of the input sequence.

For details and examples, see xsl:merge.

Links to W3C specifications

XSLT 3.0 Specification

See also