From: Michael Kay <mike@sa...>  20140216 18:48:28

On 16 Feb 2014, at 12:04, Ludovic Kuty <mailing@...> wrote: > Dear ML users, > > I have tried a little example with SaxonEE 9.5.1.4J and thought that the untyped value would be converted to xs:integer instead of xs:double. I'm not sure why you expected that. The rules for arithmetic operations in XPath 2.0 are: • Atomization is applied to the operand. The result of this operation is called the atomized operand. • If the atomized operand is an empty sequence, the result of the arithmetic expression is an empty sequence, and the implementation need not evaluate the other operand or apply the operator. However, an implementation may choose to evaluate the other operand in order to determine whether it raises an error. • If the atomized operand is a sequence of length greater than one, a type error is raised [err:XPTY0004]. • If the atomized operand is of type xs:untypedAtomic, it is cast to xs:double. If the cast fails, a dynamic error is raised. [err:FORG0001] The fourth rule kicks in here, and converts the untyped operand to double. You're then adding integer plus double, which returns a double. Michael Kay Saxonica 