You can re-order elements with xsl:sort.
This only applies to xsl:apply-templates and xsl:for-each.
You place an xsl:sort element as the first child of xsl:apply-templates or xsl:for-each.
Example:
<xsl:apply-templates> <xsl:sort select="name"/> </xsl:apply-templates>