I am new to Xquery and having a hard time dealing with this problem. Basically, my current XML file's structure is like this:
<root>
<a>
<aid>XX</aid>
...
</a>
<a>
<aid>xx</aid>
...
</a>
<b>
<bid>xx</bid>
...
</b>
<b>
<bid>xx</bid>
...
</b>
...
</root>
What I am trying to get is the information of the b elements whose "bid" do not equal to any "aid" from the a elements. I tried to do it like this. First I let a variable to hold the aid:
let $aid := (xpath to the aid elements)
then I tried to do something like the "SELECT WHERE IN" from traditional sql. namely:
for $b in (xpath to b elements)
where $b/bid != $aid (I tried to achieve the NOT IN effect)
return $b/(infomation)
But the problem is I can't find the right method to do this. I also tried
where $e/bid != $aid[*]
, it didn't work either. So am I on a wrong track? Is there anyway to achieve this in Xquery(1.0)? Or is there other methods to get the required infomation?
No comments:
Post a Comment