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

Sorting according to case

Attribute case-order with values "upper-first" or "lower-first" specifies wether lowercase or uppercase letters have preference.

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="/">
                  <upper>
                        <xsl:apply-templates  select="/aaa/bbb">
                              <xsl:sort  case-order="upper-first"/>
                        </xsl:apply-templates>
                  </upper>
                  <lower>
                        <xsl:apply-templates  select="/aaa/bbb">
                              <xsl:sort  case-order="lower-first"/>
                        </xsl:apply-templates>
                  </lower>
                  <default>
                        <xsl:apply-templates  select="/aaa/bbb">
                              <xsl:sort/>
                        </xsl:apply-templates>
                  </default>
            </xsl:template>

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

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>a</bbb>
            <bbb>b</bbb>
            <bbb>A</bbb>
            <bbb>B</bbb>
      </aaa>
Output

      <upper>
            <bbb>A</bbb>
            <bbb>a</bbb>
            <bbb>B</bbb>
            <bbb>b</bbb>
      </upper>
      <lower>
            <bbb>a</bbb>
            <bbb>A</bbb>
            <bbb>b</bbb>
            <bbb>B</bbb>
      </lower>
      <default>
            <bbb>a</bbb>
            <bbb>A</bbb>
            <bbb>b</bbb>
            <bbb>B</bbb>
      </default>


Previous chapter: Number Formatting
Next chapter: Axes
Previous page: Reverse sorting
Next page: Sorting numbers

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