Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Groups (6/10) >

Grouping in sequences with group-adjacent

Also the xsl:for-each-group with group-adjacentCan be used on any sequence.
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">
                  <xsl:for-each-group  select="1 to 10"
                              group-adjacent=". mod 5 > 0">
                        <value>
                              <xsl:value-of  select="."/>
                        </value>
                        <group-members>
                              <xsl:for-each  select="current-group()">
                                    <value>
                                          <xsl:value-of  select="."/>
                                    </value>
                              </xsl:for-each>
                        </group-members>
                  </xsl:for-each-group>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <value>1</value>
      <group-members>
            <value>1</value>
            <value>2</value>
            <value>3</value>
            <value>4</value>
      </group-members>
      <value>5</value>
      <group-members>
            <value>5</value>
      </group-members>
      <value>6</value>
      <group-members>
            <value>6</value>
            <value>7</value>
            <value>8</value>
            <value>9</value>
      </group-members>
      <value>10</value>
      <group-members>
            <value>10</value>
      </group-members>


Previous chapter: Elements and attributes
Next chapter: Multiple source documents
Previous page: Grouping in sequences with group-by
Next page: An example of current-group usage

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