XPath/XQuery divide-yearMonthDuration function

Summary

Returns the result of dividing the value of $arg1 by $arg2. The result is rounded to the nearest month.

Operator Mapping

Defines the semantics of the "div" operator when applied to an xs:yearMonthDuration and a numeric value.

Signature

op:divide-yearMonthDuration(
$arg1 as xs:yearMonthDuration,
$arg2 as xs:double
) as xs:yearMonthDuration

Rules

The result is the xs:yearMonthDuration whose length in months is equal to the result of applying the fn:round function to the value obtained by dividing the length in months of $arg1 by the value of $arg2.

If $arg2 is positive or negative infinity, the result is a zero-length duration. If $arg2 is positive or negative zero, the result overflows and is handled as described in .

For handling of overflow and underflow, see .

Examples

The expression op:divide-yearMonthDuration(xs:yearMonthDuration("P2Y11M"), 1.5) returns xs:yearMonthDuration("P1Y11M").

Error Conditions

A dynamic error is raised if $arg2 is NaN.

Notes

Either operand (and therefore the result) may be negative.