A static type error may be reported if an operand of an
expression is known at compile time to have the type
xdt:untypedAtomic, even though the expression would
succeed at runtime.
This will only happen if a variable (or function
parameter) is explicitly declared with the type
xdt:untypedAtomic. As a circumvention, change the type
declaration to xdt:anyAtomicType.
This affects both XSLT and XQuery.
Source code fixed (in TypeChecker). Test cases added: