Description
fn:round-half-to-even() appears to be returning a decimal string, which causes issues when an integer type is expected.
The following elements both trigger a schema definition error
<xs:element name="a" type="xs:int"
dfdl:inputValueCalc="{ (fn:round-half-to-even( 0.1 )) }"
/>
<xs:element name="a" type="xs:int"
dfdl:inputValueCalc="{ xs:int(fn:round-half-to-even( 0.1 )) }"
/>
[error] Schema Definition Error: Cannot convert '0.0' from String type to Long (Cannot convert to type long: For input string: "0.0").
In contrast, casting to a double, as below, appears to work as expected:
<xs:element name="a" type="xs:int"
dfdl:inputValueCalc="{ xs:double(fn:round-half-to-even( 0.1 )) }"
/>
What appears to be happening is that fn:round-half-to-even( 0.1 ) returns the string "0.0", and the type="xs:int" on the element triggers an implicit cast to an integer type. Since "0.0" contains a decimal point, this cast fail. However, an explict cast to xs:double can succeed, and then the explicit cast to an int from the double works as expected.
Complete example schema attached