The ceiling() function

Smartsite 7.4 - ...

The ceiling() XPath 2.0 function rounds arg upwards to a whole number.

XML CopyCode image Copy Code
numeric fn:ceiling(arg)

Parameters:

  • arg: a node reference or literal.

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:fn="http://www.w3.org/2005/xpath-functions"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
    <data xmlns="">
     <pos>10.5</pos>
     <neg>-10.5</neg>
    </data>
   </xf:instance>
  </xf:model>
 </head>
 <body>
  <xf:group>
   <xf:output value="fn:ceiling(pos)" />
   <xf:output value="fn:ceiling(neg)" />
   <xf:output value="fn:ceiling(10.6)" />
   <xf:output value="fn:ceiling(10.4)" />
  </xf:group>
 </body>
</html>

The result will be:

11
-10
11
11

Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).