indeed.... how did I miss that..I'll tell you.. once I saw that a comparison was involved I was expecting to be declaratively told what type of comparison. Thats what I looked for and didn't see it.
I didn't expect to see an algorithm and didn't recognise what it was. On Wed, Apr 2, 2014 at 5:39 PM, Michael Kay <[email protected]> wrote: > > On 2 Apr 2014, at 17:13, Ihe Onwuka <[email protected]> wrote: > >> Excerpt from the 3.13 of the XQuery 3.0 specification. >> >> "In a switch expression, the switch keyword is followed by an >> expression enclosed in parentheses, called the switch operand >> expression. This is the expression whose value is being compared." >> >> The issue is the last word - compared. >> >> XPath has general and value based comparisons and the spec doesn't say >> what type of comparison is operative for comparisons on the switch >> operand expression. >> _______________________________________________ > > Not sure how you missed this, but it says this in great detail: > > The resulting value is matched against each SwitchCaseOperand in turn until a > match is found or the list is exhausted. The matching is performed as follows: > > * The SwitchCaseOperand is evaluated. > * The resulting value is atomized. > * If the atomized sequence has length greater than one, a type error > is raised [err:XPTY0004]. > * The atomized value of the switch operand expression is compared > with the atomized value of the SwitchCaseOperand using the fn:deep-equal > function, with the default collation from the static context. > > Using fn:deep-equal() on two atomic values is almost the same as using "eq", > except that you get false rather than an error if the values are of > incomparable types, and you get true if you compare NaN to NaN. > > Michael Kay > Saxonica > _______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
