example i have xml data like this
<a>
<book id="bk1">
<test>Yeah</test>
</book>
<book id="bk2">
<test>Hellow</test>
</book>
<book id="bk3">
<test>yaya</test>
<test>love</test>
<test>hello</test>
</book>
</a>
my question is using xquery to select the book id where test element doesn't contain any value="love"
expected output:
<book id="bk1"/>
<book id="bk2"/>
but my output is like :
<book id="bk1"/>
<book id="bk2"/>
<book id="bk3"/>
following code:
for $b in /a
let $i := $b/book/test
let $id := $b/book/@id
where $i != "love"
return <book id="@id"/>
i suspect it's go to looping for bk3 and found another test value which is not love and return it. how to solve it?
<book/>elements must be closed. Is this really the input you're given? - Jens Erat