Reputation: 203
I currently have this query, but it only returns a boolean value TRUE.
let $expression1 := (0, 11, 22, 34, 36, 57)
let $expression2 := (16, 17, 57, 18)
for $item in ($sequence1 = $sequence2)
return $item
This query currently returns the boolean TRUE. How would I be able to return a sequence of two values: the value of the first expression and the value of the second expression instead?
Any help would be greatly appreciated. Thanks.
Upvotes: 0
Views: 34
Reputation: 11771
You are getting a boolean result because ($sequence1 = $sequence2)
evaluates to "Is there any value in $sequence1
equal to any value in $sequence2
?". This evaluates to for $item in true() return $item
, which returns the single boolean.
If you want to return only values that are in both sequences:
return $sequence1[. = $sequence2]
If you want to return both sequences together:
return ($sequence1, $sequence2)
If you want to return both sequences without duplicates:
return distinct-values(($sequence1, $sequence2))
Upvotes: 2