apply-templates in reverse order
Easy!
<xsl:template match="/">
<xsl:apply-templates select="root/node">
<xsl:sort select="position()" data-type="number" order="descending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="node">
<xsl:value-of select="."/>
</xsl:template>
You can do this, using xsl:sort
. It is important to set the data-type="number"
because else, the position will be sorted as a string, end therefor, the 10th node would ge considered before the 2nd one.
<xsl:template match="/">
<xsl:apply-templates select="root/node">
<xsl:sort
select="position()"
order="descending"
data-type="number"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="node">
<xsl:value-of select="."/>
</xsl:template>