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" } />
select
attribute is "."
. This causes the string-value of the current node to be used as the sort key.lang
value is specified, the language is determined from the system environment.data-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.
"ascending"
."upper-first"
, which sorts the strings with uppercase letter first.Number of occurrences | Unlimited |
Parent elements | xsl:apply-templates, xsl:for-each |
Child elements | (No child elements) |
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
See the example in Sorting XML Using <xsl:sort>.