<xsl:sort> ElementÂ
Specifies sort criteria for node lists selected by <xsl:for-each>
or <xsl:apply-templates>
.
<xsl:sort
select = string-expression
lang = { nmtoken }
data-type = { "text" | "number" | QName }
order = { "ascending" | "descending" }
case-order = { "upper-first" | "lower-first" }
/>
Attributes
- select
The sort key for the node. An expression that is evaluated with the specified node as the current node, and with the complete list of nodes being processed in unsorted order as the current node-list. The resulting object is converted to a string that is used as the sort key for that node. The default value of theselect
attribute is"."
. This causes the string-value of the current node to be used as the sort key.
- lang
The language alphabet used to determine sort order. If nolang
value is specified, the language is determined from the system environment.
data-type
The data type of the strings. The following table list the values allowed for thedata-type
attribute.text
Specifies that the sort keys should be sorted alphabetically.
number
Specifies that the sort keys should be converted to numbers and then sorted according to the numeric value. The sort key is converted to a number.
QName
Expanded into a expanded-name. The expanded-name identifies the data type.
If no data type is specified, the type of the expression will be used as the default.
- order
The sort order for the strings. The default value is"ascending"
.
- case-order
The order in which to sort strings by capitalization. The default value is"upper-first"
, which sorts the strings with uppercase letter first.
Element Information
Number of occurrences |
Unlimited |
Parent elements |
|
Child elements |
(No child elements) |
Remarks
This sorting algorithm ignores dashes when sorting. This is the "word-sort" method, intended to sort words like "co-op" next to "coop".
For example, the following sort order is produced:
30a-allow
30-allow
Thus the sort treats the items as though they were:
30aallow
30allow