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

Sorting nodes - xsl:sort

Nodes selected by xsl:apply-templatesCan be alphabetically sorted using xsl:sort element as a child of the instruction. If there is no select attribute on the xsl:sort element then the text content of the nodes is used as the sorting criterion.

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/>
                  </xsl:apply-templates>
            </xsl:template>

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

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>C</bbb>
            <bbb>A</bbb>
            <bbb>D</bbb>
            <bbb>B</bbb>
      </aaa>
Output

      <bbb>A</bbb>
      <bbb>B</bbb>
      <bbb>C</bbb>
      <bbb>D</bbb>


Previous chapter: Number Formatting
Next chapter: Axes
Previous page: - - -
Next page: Select attribute of xsl:sort

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver 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