Dear BaseX team,

can you help me with the following, very general problem?

I have a huge document in a database and want to iterate over many nodes which it contains, performing for each one an action which does not produce a value - for example, storing it in a SQL database.

I want to persuade the processor to visit, process and forget the nodes one after the other, rather than to attempt loading all nodes into memory before proceeding to process them. Schematically:

declare function f:processNode($node as node())  as empty-sequence() {...};

for $node in doc('huge-doc')/a/b/c
return f:processNode($node)

 ~ ~ ~

Well, in some cases it works, in others in doesn't. Is there any safe way how to enforce sequential visit-process-forget processing?

I call this problem general because it is a critical aspect of dealing with huge documents.

Cheers,
Hans-Jürgen