BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
684 stars 265 forks source link

XQuery: Simple map, if expressions #2175

Closed ChristianGruen closed 1 year ago

ChristianGruen commented 1 year ago
EXPR ! (if(CONDITION) then THEN else ())

…can be rewritten to…

EXPR[CONDITION] ! THEN 

…provided that a) the condition is not numeric and b) the condition and the branch are not positional. The following expressions are not equivalent:

(0 to 5) ! (if(.) then 1 else ())
(0 to 5)[.] ! 1

(0 to 5) ! (if(boolean(.)) then position() else ())
(0 to 5)[boolean(.)] ! position()