Hello all, sorry this email is not properly basex specific but rather XQuery related. What is the most correct, most efficient in general best way of treating sequences sequentially? In particular I have an XML describing a sequence of set operations that have to be applied sequentially to the contained sequences of <tem/>s resulting into a final set represented by a sequence of <item/>s. Unfortunately they are expressed as siblings (flat) rather than dependent nodes (nested hierarchy) which could be handled easily with recursion. As an example the following sequence shall add the first three items to the empty set then cut down the resulting set to only contain item 2 and 3 and finally remove item 2 from the set resulting in a final set containing only item 3.
<set operator="UNION"> <item name="1"/> <item name="2"/> <item name="3"/> </set> <set operator="INTERSECT"> <item name="2"/> <item name="3"/> <item name="4"/> <item name="5"/> </set> <set operator="DIFFERENCE"> <item name="2"/> </set>
I'd prefer to not have to alter the input data structure. Thanks a lot for any help, M.