Return the remainder of dividing $decimal-var1 by $decimal-var2. The mod operator invokes the decimal-mod operator.
If the value of $decimal-var2 is equal to zero, the TransformException exception is raised with the RT_DIV_ZERO fault code. The following error message is displayed in the mapper:
Error occurred while executing XQuery: division by zero
op:decimal-mod(xs:decimal $decimal-var1, xs:decimal $decimal-var2) —> xs:decimal
Returns the remainder of dividing $decimal-var1 by $decimal-var2.
Invoking decimal-mod("2.1","2.0") returns the decimal value .1 because 2.1 divided by 2.0 results in 1 with the remainder: .1. The remainder: .1 is returned as shown in the following example query:
<decimal-mod>{op:decimal-mod("2.1","2.0")}</decimal-mod>
The preceding query generates the following result:
<decimal-mod>0.1</decimal-mod>
Invoking decimal-mod("2.2","0")throws the TransformException exception with the RT_DIV_ZERO fault code as shown in the following example query:
<decimal-mod>{op:decimal-mod("2.2","0")}</decimal-mod>
The following error message is displayed in the mapper:
Error occurred while executing XQuery: division by zero
W3C decimal data type description.
W3C numeric-mod operator description.