Wednesday 2 June 2010

MarkLogic: XQuery: Typeswitching based on input "type"

In a previous post I'd created on Function Overloading in XQuery, there has been a brief discussion (so far) on whether you can overload functions based on type.

This was the given example:


Throws this:

Which appears to be part of the spec:

Is there a workaround? The only way around this issue that I know of right now is to use a typeswitch:


Will give you the expected results - albeit at the cost of having to write (and manage) more code.

No comments: