Saxon is behaving correctly according to the spec. See

When you use the eq operator, an untypedAtomic value is treated as a string, and you cannot compare a string to a number. Either use the "=" operator, or convert the string to a number explicitly by writing 

return number($val) eq sum($val2/*) 

Michael Kay

On 17 Jun 2013, at 12:04, Kunal Chauhan wrote:


As per my requirement I am binding XQItem of a node.
and I am processing it, it gives me following error.

can't to compare xs:untypedAtomic type to xs:double

Below is an example :

let $val := <a>5</a>
let $val2 := <a><a1>3</a1>

return $val eq sum($val2/*)

Note : for $val and $val2, I am binding XQItem from the java code.
$val2 contains list of nodes, while $val having a single node.

When expression is evaluate, sum returns value in xs:double type while $val is xs:untypedAtomic.

So, that I am facing an error.

Is there any way to solve this error?

Kunal Chauhan
This email is sponsored by Windows:

Build for Windows Store.
saxon-help mailing list archived at