for $path in ('/db/a', '/db/b')
for $result in collection($path)//test[...]
return
    ...