The xsl:for-each instruction contains a template, which is applied to each node selected with select attribute.
Nodes selected with xsl:for-each (This stylesheet and This stylesheet) or xsl:apply-templates (This stylesheet) can be sorted. Order of sorting determines order attribute. This stylesheet sorts in ascending and This stylesheet in descending mode.
This stylesheet sorts in text and This stylesheet in numeric mode. Notice the important difference. 2 is after 1 in alphabet so 2 goes after 10 in text mode.
This stylesheet sorts upercase and This stylesheet lowercase letters first.