Sorting Elements

You can use <xsl:sort>to sort nodes. This element sets the order of node processing for <xsl:apply-templates> and <xsl:for-each>. The following list includes the attributes of <xsl:sort>:

  • select(optional). Sets to an XPath expression that returns a node set to sort. The default is “string(.)”.

  • order(optional). Sets the sort order; set to “ascending” or “descending”.

  • case-order(optional). Determines whether upper-case letters come before lower-case letters. Set to “upper-first” or “lower-first”.

  • lang(optional). Sets the language whose sorting conventions are to be used. Set to a language code valid in the xml:lang attribute.

  • data-type(optional). Sets whether the sort should be alphabetical or numerical. Set to “text”, “number”, or ...

Get Inside XSLT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.