"Ramon F. Herrera" <> writes:
> which is initially set to the top/root of the document:
>
> http://xqilla.sourceforge.net/docs/s...p-example.html
Here is the outer context being set to the top of the document:
// Parse a document, and set it as the context item
Sequence seq = context->resolveDocument(X("foo.xml"));
if(!seq.isEmpty() && seq.first()->isNode()) {
context->setContextItem(seq.first());
context->setContextPosition(1);
context->setContextSize(1);
}
// Execute the query, using the context
Result result = query->execute(context);
Result is a sequence of "items" (in my terminology, Nodes).
// Iterate over the results, printing them
Item:

tr item;
while(item = result->next(context)) {
At this point, I'd expect you to be able to convert 'item' from the
generalized Item:

tr to a Node, and create a local DynamicContext
object (called something other than 'context', to avoid confusion, of
course) and set it up in the same way as the outer context was set up
above, but referring to this Node. You'd then set up the appropriate
XQQuery and execute it on this local context.
I'm afraid I don't know C++ or XQilla well enough to say how to do the
crucial step of converting item to a Node. Maybe there's an
Item::asNode() operation? Maybe you don't need to? Maybe it's as simple
as
if (item->isNode()) {
// create query q, context c
c->setContextItem(item); // here where you change context
// set position, size???
Result r = q->execute(c);
// process result
}