Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Sequences (7/10) >

Function reverse

The reverse() function reverses the order in the sequence. Note the brackets in the second example. The reverse() function accepts precisely one argument. As the arguments of functions are separated by comma, an argument which creates a sequence must be enclosed by brackets.
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="/aaa">
                  <xxx>
                        <xsl:value-of  select="reverse(1 to 5)"/>
                  </xxx>
                  <yyy>
                        <xsl:value-of  select="reverse(('c','b','a'))"/>
                  </yyy>
                  <zzz>
                        <xsl:value-of  select="reverse(bbb)"/>
                  </zzz>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>b1</bbb>
            <bbb>b2</bbb>
            <bbb>b3</bbb>
      </aaa>
Output

      <xxx>5 4 3 2 1</xxx>
      <yyy>a b c</yyy>
      <zzz>b3 b2 b1</zzz>


Previous chapter: Templates - basic usage
Next chapter: Sequence Combinations
Previous page: Combination of sequences created with "to" operator
Next page: Creation of sequences using for... in... return instruction

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