سؤال

I am using eXist-db for XML file handling. I have a collection named /db/Sample/Mycollection. To iterate over all files in the collection I can use

for $x in collection("/db/Sample/Mycollection")
let $z:= ...
return ...

But in this collection I have files with filenames 2060.xml, 2061.xml, and so on. Now I want to query over first 10 files like 2060.xml to 2069.xml or any number of files. How can I achieve this? Is there any function that can achieve this?

هل كانت مفيدة؟

المحلول

The subsequence() function is your friend. To query over only the first 10 files:

for $x in subsequence(collection("/db/Sample/Mycollection), 1, 10)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top