number()Convert to number
Converts a value to a number. Strings that look like numbers are parsed; non-numeric strings become NaN. When called on a boolean, true becomes 1 and false becomes 0. This is useful for explicit type conversion in arithmetic or comparisons.
sum(node-set)Sum of numeric values
Adds up the numeric values of all nodes in the set. Each node's string value is converted to a number. This is perfect for totaling quantities — for example, summing order amounts, counts, or any numeric element content across multiple nodes.
floor(n)Round down
Returns the largest integer that is not greater than the argument. floor(3.7) returns 3, floor(-1.2) returns -2. Useful when you need to truncate to a whole number or do integer division in XPath expressions.
ceiling(n)Round up
Returns the smallest integer that is not less than the argument. ceiling(3.2) returns 4, ceiling(-1.8) returns -1. Useful when you need to round up — for example, calculating the minimum number of batches needed to serve everyone.
round(n)Round to nearest integer
Rounds to the nearest integer. When the value is exactly halfway (like 2.5), it rounds toward positive infinity — so round(2.5) is 3. This follows the IEEE 754 rounding convention used in XPath.