August 2001
Intermediate to advanced
480 pages
11h 16m
English
floor() Function — Returns the largest integer that is not greater than the argument.
numberfloor(number)
A number. If the argument is not a number, it is transformed into a number as if it had been processed by the number() function. If the argument cannot be transformed into a number, the floor() function returns NaN (not a number).
The largest integer that is not greater than the argument, or NaN if the argument cannot be converted into a number.
XPath section 4.4, Number Functions.
The following stylesheet shows the results of invoking the floor() function against a variety of values. We’ll use this XML document as input:
<?xml version="1.0"?>
<report>
<title>Miles Flown in 2001</title>
<month sequence="01">
<miles-flown>12379</miles-flown>
<miles-earned>35215</miles-earned>
</month>
<month sequence="02">
<miles-flown>32857</miles-flown>
<miles-earned>92731</miles-earned>
</month>
<month sequence="03">
<miles-flown>19920</miles-flown>
<miles-earned>76725</miles-earned>
</month>
<month sequence="04">
<miles-flown>18903</miles-flown>
<miles-earned>31781</miles-earned>
</month>
</report>Here’s the stylesheet that uses the floor() function:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:months="Lookup table for month names"> <months:name sequence="01">January</months:name> <months:name sequence="02">February</months:name> <months:name sequence="03">March</months:name> <months:name ...