O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

<xsl:sort>

Defines a sort key for the current context. The first <xsl:sort> defines the primary sort key, the second <xsl:sort> defines the secondary sort key, etc. You can have as many <xsl:sort> elements as you need.

Category

Subinstruction.

Required Attributes

None.

Optional Attributes

select

Determines the nodes to be sorted. You can also omit the select attribute and use the contents of the <xsl:sort> element to define the nodes to be sorted.

lang

A string that defines the language used by the sort. The language codes are defined in RFC1766, available at http://www.ietf.org/rfc/rfc1766.txt. Not all processors support all languages, so check your XSLT processor’s documentation.

data-type

An attribute that defines the type of the items to be sorted. Allowable values are number and text; the default is text. An XSLT processor has the option of supporting other values as well. Sorting the values 32 10 120 with data-type="text" returns 10 120 32, while data-type="number" returns 10 32 120.

[2.0] In XSLT 2.0, you can specify a QName that represents some other datatype. How (or if) that value is processed can vary from one XSLT processor to another.

order

An attribute that defines the order of the sort. Allowable values are ascending and descending.

case-order

An attribute that defines the order in which upper- and lowercase letters are sorted. Allowable values are upper-first and lower-first.

[2.0] collation

The collation order used by this sort. For example, in Spanish, the single letter ll

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required