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

An example of current-group() usage

The groups selected with current-group() are useful in many scenarios.

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 9"
                              group-by=". mod 5">
                        <item>
                              <xsl:value-of  select="string-join(for $i in current-group() return string($i),'+')"/>
                              <xsl:text>=</xsl:text>
                              <xsl:value-of  select="sum(current-group())"/>
                        </item>
                  </xsl:for-each-group>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <item>1+6=7</item>
      <item>2+7=9</item>
      <item>3+8=11</item>
      <item>4+9=13</item>
      <item>5=5</item>


Previous chapter: Elements and attributes
Next chapter: Multiple source documents
Previous page: Grouping in sequences with group-adjacent
Next page: Groups generated with group-by using several key values

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