HiShaun,
I do not understand why that should be as there is clearly no mention of xs:double in this query!
I agree that the error message is misleading. You already get it when invoking the following expression:
'a' cast as xs:integer
I need to check the code, but I assume that an additional double conversion check takes place in the background in order to ensure that the value can actually be converted to a non-fractional number.
For more information on your query, it would be great if you could reduce it to a self-contained example that runs out of the box (I tried to invoke it, but your code seems to rely on an opened database).
Best, Christian