May 15, 2023

Floor - XpressDox

Use the floor() XSLT function in XpressDox

The ceiling and floor functions are two XSLT functions but can also be used in XpressDox, and are available in Command Editor.  In essence, they perform the equivalent of a “round up” (ceiling) and “round down” (floor) to the nearest integer.

For example, if the value 25 has been captured into data element Amount, then

«ceiling(RegionToX(Amount) div 3)»

will output the value 9

and

«floor(RegionToX(Amount) div 3)»

will output 8.

Note the use of the RegionToX function – this is because the ceiling and floor functions are XSLT functions and thus need an XSLT-compliant number format passed to them. So if you are in a region where your regional settings indicate a decimal character other than ‘.’ (period or full-stop), and you know that Amount will conform to those regional settings, then the RegionToX function needs to be employed. More on this at: Handling calculations and Regional Settings in XpressDox.