Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Arithmetics (3/6) >

Modulus

Operator "mod"Calculates modulus: the remainder resulting from dividing the first argument by the second one. The operator is very useful when alternative sequences are needed.

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">
                  <bbb>
                        <xsl:value-of  select="a[. mod 2 = 1]"/>
                  </bbb>
                  <ccc>
                        <xsl:value-of  select="for $a in (1 to 100) return if ($a mod 9 = 0) then $a else ()"/>
                  </ccc>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <a>5</a>
            <a>3</a>
            <a>7</a>
            <a>2</a>
      </aaa>
Output

      <bbb>5 3 7</bbb>
      <ccc>9 18 27 36 45 54 63 72 81 90 99</ccc>


Previous chapter: Implicit behaviour
Next chapter: Functions operating on strings
Previous page: Multiplication and division
Next page: Summation

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