Besides primary expressions, XPath 2.0 also supports arithmetic operators for addition, subtraction, multiplication, division, and modulus . These operators are represented this way (note that instead of using the / symbol for division, which can be interpreted as markup, XPath 2.0 uses the div operator):
USING THE SUBTRACTION OPERATOR
In XPath 2.0, you must precede a subtraction operator with a space, because "-" is a legal name character. In other words, x-y can be interpreted as a name, whereas x - y is an expression involving a subtraction operation.
The idiv operator requires its operands to be of type xs:integer and returns a result of type xs:integer , rounded toward zero. And the mod operator returns the remainder after a division (for example, 16 mod 3 is 1).
Here are some examples of arithmetic expressions:
SUBTRACTING DATE VALUES
In XPath 2.0, if you subtract two date values, the result is of the xdt:dayTimeDuration type.