I have XML files in eXist-db in the following collections:
- /db/OCR/Everest_Bank/(xml files are here)
- /db/OCR/Siddhartha_Bank/(xml files are here)
- /db/OCR/ABC_Bank/(xml files are here)
I want to run an XQuery in the /db/OCR collection across all the "banks" satisfying a condition and want to return the name of the bank which satisfied the condition. I wrote a query but am stuck in the return part of the FLWOR expression.
declare default element namespace 'http://www.xbrl.org/2003/instance';
declare namespace ifrs = 'http://xbrl.ifrs.org/taxonomy/2013-03-28/ifrs';
for $x in collection("/db/OCR")
let $z := $x/xbrl/ifrs:Assets (: want to have query in assets of all files in the banks :)
return
if (exists($z) and xs:integer($z/text())>9999999)
then ???
Now how can I return the collection name like "Everest_Bank" for the results that satisfy my conditions? Please help.