Sorting

Another feature of XSLT is the ability to sort elements based on a specific set of criteria.

xsl:sort

Attributes:

  • select— This attribute uses an XPath expression to select the component, which is used as the key for the sort.

  • lang— This attribute allows you to select the language for the sort, which will govern how alphabetical sorting will occur, based on the character set for the specified language.

  • data-type— This attribute allows you to specify the datatype of the key values, which are used in sorting, and can accept values of text or number. If text is selected, then the sort is performed in accordance with the rules for sorting text, based on the language selected. If number is selected, then the sort is performed based on a numbered ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.