This content has been marked as final. Show 7 replies
I don't understand what you intend to do by putting a whitespace there.
Could you explain?
If you want to test for $TRP = (COLIS or FRC), I'm afraid it's not possible that way :
You'll have to test both explicitely :
typeswitch ($TRP) case element (POSTE) return (...) case element (COLIS) return (...) case element (FRC) return (...) default return (...)
OK, now I understand what you're after.
The typeswitch expression is not for testing values, but item types (called SequenceType in the specs).
For example :
where $doc =
for $i in $doc/root/* return typeswitch ($i) case element(TEST) return <result>I am a TEST element</result> default return <result>I am unknown</result>
will produce :
XQuery doesn't provide switch-case statement for values like we have for other languages.
<result>I am a TEST element</result> <result>I am unknown</result> <result>I am a TEST element</result>