You have a sequence and want to know whether each item in that sequence is also in another sequence.
Applies to MarkLogic versions 7+
declare function local:seq-contains($s1 as item()*, $s2 as item()*) { every $s in $s1 satisfies $s = $s2 }; local:seq-contains((1, 2), (1, 2, 3, 4)) => true local:seq-contains((2, 1), (1, 2, 3, 4)) => true (order does not matter) local:seq-contains(('a', 'b', 'z'), ('a', 'b', 'c', 'd')) => false
The line of code within the local:seq-contains
function is a Quantified Expression. This will work with scalar values as well as with nodes, making it a flexible way of determining membership.
By continuing to use this website you are giving consent to cookies being used in accordance with the MarkLogic Privacy Statement.