Sorting with XSLT
Using XSLT to sort data in an XML document is fairly straightforward. For each sort key you want to use for a given element, add an <xml:sort>
element as a child of either the <xsl:for-each>
element or the <xsl:apply-templates>
element.
The topics in this section refer to the prodsort example. The XSLT file and the XML file for this example are at the end of the section.
This section contains the following topics.
- Basic Sorting in XSLT
- Sorting on Calculated Variables
- Sample XML Data File for XSLT Sorting
- Sample XSLT File for Sorting