This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I think it may improve usability if we modify map:remove to take a sequence of key values instead of a single key value. This would make it easier to conditionally remove entries from a map. Consider this map: declare variable $m := map { 0 : "blue", 2 : "red", 4 : "blue", 6 : "green" }; Assume the goal is to remove the "blue" entries without knowing the keys in advance. I came up with two solutions for this. The first uses a recursive user defined function: declare function local:removeAll($m as map(*), $keys) { if (exists($keys)) then local:removeAll(map:remove($m,$keys[1]), tail($keys)) else $m }; local:removeAll($m, map:keys($m)[$m(.) eq "blue"]) Here is another solution that filters and reconstructs: map:merge( for $k in map:keys($m) where $m($k) ne "blue" return map:entry($k, $m($k)) ) It is more succinct and I think more intuitive to use map:remove directly: map:remove($m, map:keys($m)[$m(.) eq "blue"]) If this change makes sense, then I expect we would want to consider making a similar change to array:remove as well.
This proposal was accepted at XML Query/XSL WG Joint Teleconference #644 on 2016-05-24. DECISION: Modify map:remove() and array:remove() to allow multiple key arguments as requested by bug 29660.
The changes have been applied to the F+O 3.1 and XSLT 3.0 specifications (but not yet committed).