Ordering options

Some options are available for changing the default sorting behaviour in some limited ways. Attributes on the Sort element are used to specify these changes.

Numerical ordering

It is possible to sort by numerical value. This is very different from sorting by characters when the characters happen to be digits. Normal sorting simply ranks digits by their ASCII value:

<P>1999</P>
<P>29</P>
<P>399</P>

In this example, '1999' is the first item because it begins with a '1'. But the numbers are clearly not ranked by value, as '1999' is larger than '29', which is smaller than '399'. Ordering by value can be achieved using the Data Type attribute. It has a default value of 'text', but can be given an explicit value of 'number'. The ...

Get XSL companion, The 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.