XQuery Sequence Operators

except

Find all items except the 'Red' type item:

   let $allitem := document("data/items.xml")//item/itemno
   
   let $orderitem:= document("data/items.xml")//item[ItemType='Red']/itemno

   return 
   <result>
   {$allitem except $orderitem}
   </result>

node-after (>>), node-before (<<), and node-equal (==, !==)

Find all the items that occur after itemno '0031' in document order:

   let $theitem := document("data/items.xml")//item[itemno='0031']/itemno

   for $allitem in document("data/items.xml")//item/itemno
   where $allitem >> $theitem
   return 
   <result>
   {$allitem}
   </result>