Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Sorting (2/8) >

Select attribute of xsl:sort

Sorting criterion can be given with the sort attribute. The path of sorting criterion is given relatively to the path selected by xsl:apply-templates.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/">
                  <xsl:apply-templates  select="/aaa/bbb">
                        <xsl:sort  select="@x"/>
                  </xsl:apply-templates>
            </xsl:template>

            <xsl:template  match="bbb">
                  <bbb>
                        <xsl:value-of  select="."/>
                  </bbb>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb  x="d">1</bbb>
            <bbb  x="b">2</bbb>
            <bbb  x="c">3</bbb>
            <bbb  x="a">4</bbb>
      </aaa>
Output

      <bbb>4</bbb>
      <bbb>2</bbb>
      <bbb>3</bbb>
      <bbb>1</bbb>


Previous chapter: Number Formatting
Next chapter: Axes
Previous page: Sorting nodes - xsl:sort
Next page: Reverse sorting

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks