Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT Element

XSLT xsl:sort Element


XSLT Element Reference Manual XSLT Element Reference Manual


Definition and Usage

xsl:sort The element is used to sort the output result.

Note:xsl:sort It is always located inside the xsl:for-each or xsl:apply-templates element.


Syntax

lang="language-code"

data-type="text|number|qname"

order="ascending|descending"

case-order="upper-first|lower-first"/>

property

property Value Description
select XPath-expression Optional. Specifies the sort key of the nodes, that is, which node or node-set to sort by.
lang language-code Optional. Specifies the language used for sorting.
data-type text
 number       

 qname | 可选。规定被排序的数据的数据类型。默认是 "text"。 |

| order | ascending
descending | Optional. Specifies the sort order. Default is "ascending". | | case-order | upper-first
lower-first | Optional. Specifies whether to sort uppercase letters first or lowercase letters first. |


Example

The following example sorts by artist as the key:

Example

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

My CD Collection

Title Artist

Try it »


XSLT Element Reference Manual XSLT Element Reference Manual