RE: top-level location-path context dependencies

> I'm trying to understand the ways in
> which implementations can effect the settings of the 
> top-level context item,
> as outlined in "C.2 Dynamic Context Components" in the main 
> XQuery document> [1].

The expectation is that implementations are likely to provide an API
allowing the context item to be initialized. In Saxon, for example, the
XQueryExpression#evaluate() method takes an argument of type
DynamicQueryContext, and the DynamicQueryContext object has a method
setContextItem() or setContextNode(). If invoked from the command line, the
initial context item can be set to the document node of an XML document
using the option "-s source.xml".
> 
> To be more specific, assuming a two-document context ("bib.xml" and
> "reviews.xml" from the use cases),

You're using the term "context" loosely there, I think. The context item is
always a single item. There is no such thing as a "two-document context".

> what are the results of 
> the following
> top-level queries? And which of these depends on the 
> particular environment
> and which are never dependant on the environment?

All of these queries return nodes from the document that contains the
context node. In all cases the result nodes all come from the same document,
and in all cases they depend on the way the context was initialized. If the
context has not been initialized, they throw an error.
> 
> It would be very useful to me if somebody could show the 
> above results in a tabular fashion

No table needed: there is no difference between these four cases.

Michael Kay 

Received on Saturday, 17 April 2004 17:50:22 UTC