xquery-3.1

Remove specific item in a sequence in XQuery


What is a good way to remove a specific item in a sequence?

I want to remove "b" from the sequence ("a", "b", "c") for example.

("a", "b", "c")
-> do something
-> ("a", "c")

What I know does work is to split the sequence in two and then glue them back together but I would like to know if there are nicer solutions.


Solution

  • How about $seq[. != 'b'] where $seq contains your sequence, naturally.