「for-each」を使用せずにxmlファイルをソートする演習があります。私のスクリプトでは、エントリを取得しますが、並べ替えられません。
XML ファイル: http://www.w3schools.com/xml/cd_catalog.xml
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="CD">
<br/>
<xsl:apply-templates select="TITLE" >
<xsl:sort select="TITLE"/>
</xsl:apply-templates>
</xsl:template>
THX