Finally managed to achieve the desired behavior. In contrast to yesterday’s code snippet, the solution involves
- isolating result processing into a separate path expression
XQueryExecutable xqueryExecutable = xqueryCompiler.compile( "for $x in saxon:stream(doc('" + input + "')/*/*) " + XQueryEvaluator query = xqueryExecutable.load();
This now has timing independent of the document size:
Good to see this is working.
saxon:stream() is a pseudo-function; its effect depends on the form of the expression in its argument, not just on the value of the expression, and the simplest rule is that the expression must be a call on doc() followed by something that looks like an XSLT pattern. So having /string() on the end will spoil it. You don't need a FLWOR: the following should work equally well:
saxon:stream(doc('" + input + "')/*/*)/string()