I have 2 XML files :
file1.xml
<data>doe90</data>
<data>foo</data>
<data>goo</data>
...
file2.xml
<data2>nan</data2>
<data2>goo</data2>
<data2>test</data2>
...
I stored this data in 2 vars :
let $data := //data,
$data2 := //data2
And began to do this :
for $d in $data2
return
if() (: $d is also in $data ? :)
What should I do ? Thanks
EDIT : Of course I tried contains, but got an error :
if(contains($d,$data) = 0)
An exception occurred during query execution: XPTY0004: cannot convert 'xs:boolean(true)' to xs:integer
This may help:
//data[. = //data2] ► returns elements whose string values are contained in data2
//data = //data2 ► returns true there are any matches, false otherwise
fn:contains() won’t help here, as it was built for matching substrings:
contains('abc', 'a') ► true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With