Sorting

The <xsl:sort> element sorts a set of nodes according to the criteria specified:

<xsl:apply-templates select="row">
  <xsl:sort data-type="number" select="entry[2]"/>
</xsl:apply-templates>

It can appear as a child of <xsl:apply-templates> or <xsl:for-each>. It can also be nested.