Christian,
 
I encountered some unexpected behavior with the typecasting of functionresult.
it is about the "?" in line 4 of both snippets. [expectedResult.xq], the snippet with the " ?" gives the expected result. [unexpectedResult.xq], the snipped without the "?" , gives an unexpected result.
 
Is this a correct observation or am I missing something?
mvgr.

Rob Stapper