From: Michael B. <mbe...@mb...> - 2005-10-26 14:39:07
|
Ah well, the first posting wasn't an accurate reduction of the actual code that gave rise to the issue. Now we've seen that code, here's my attempt at a reducing it, and I do think it indicates a problem: VERSION 1 for $element in ("black") return <r> <c1> { $element eq "black" or $element eq "white" } </c1> <c2> { $element eq "black" and $element eq "white" } </c2> <c1_AND_c2> { ($element eq "black" or $element eq "white") and ($element eq "black" and $element eq "white") } </c1_AND_c2> </r> Now this version produces the result you were expecting: <r> <c1>true</c1> <c2>false</c2> <c1_AND_c2>false</c1_AND_c2> </r> But let's now remove the parentheses used to constrain the sequence of Boolean evaluations, giving VERSION 2: for $element in ("black") return <r> <c1> { $element eq "black" or $element eq "white" } </c1> <c2> { $element eq "black" and $element eq "white" } </c2> <c1_AND_c2> { $element eq "black" or $element eq "white" and $element eq "black" and $element eq "white" } </c1_AND_c2> </r> NOW we get what you are reporting: <r> <c1>true</c1> <c2>false</c2> <c1_AND_c2>true</c1_AND_c2> </r> I leave it to Pierrick and others more used to doing battle with the increasingly convoluted specs to decide whether each of those results is correct (AFAIK they both are). But I would say that the original code has the pattern of grouping parentheses found in VERSION1, yet it is producing the result of VERSION2. Which may well indicate a problem with eXist's XQuery compiler. Michael Beddow |