Sorting/Reordering elements using xslt

XSLT template to reorder the elements as per the position. The order option allows you to decide the order of sort. Depending on the select XPath query result data-type can be given.

<xsl:template match="*">
    <xsl:copy>
       <xsl:apply-templates>
          <xsl:sort select="position()"order="descending" data-type="number" />
       </xsl:apply-templates>
     </xsl:copy>
  </xsl:template>


About this entry


0 comments: