XSLT <xsl:sort>
Element
Definition and Usage
The <xsl:sort>
element is used to sort the output results.
Note: <xsl:sort>
is always located inside <xsl:for-each>
or <xsl:apply-templates>
.
Syntax
Attributes
Attribute | Value | Description |
---|---|---|
select | XPath-expression | Optional. Specifies the sorting key of the nodes, i.e., which node or node-set to sort by. |
lang | language-code | Optional. Specifies the language used for sorting. |
data-type | text <br>number <br>qname | Optional. Specifies the data type of the sorted data. Default is "text". |
order | ascending <br>descending | Optional. Specifies the sorting order. Default is "ascending". |
case-order | upper-first <br>lower-first | Optional. Specifies whether to sort by uppercase or lowercase letters first. |
Example
The following example will sort by the artist key: