- From: Howard Katz <howardk@fatdog.com>
- Date: Sat, 17 Apr 2004 15:25:18 -0700
- To: "Michael Kay" <mhk@mhk.me.uk>, <www-ql@w3.org>
responses inline below ... > > 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". Any reason you couldn't set the context node to be *any* node within a particular document (altho it would likely be a very odd thing to do)? > > > > 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". You're right: very loosely. > > > 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. I think I see it -- maybe. Is the following reasoning correct then? If the environment has set the context item to be the document node for "bib.xml" [1], for example, you'd get 1) //title => 4 title elements in "bib.xml" 2) title => no elements (since no <title> element is child of the context item) 3) /bib => the root bib element 4) bib => ditto Similarly if the context item has been set to be the document node for "reviews.xml" [2], you'd get 1) //title => 3 title elements in "reviews.xml" 2) title => no elements (no <title> element is child of the context item) 3) /bib => no elements (no <bib> element is at the root of the document containing the context node 4) bib => no elements (no <bib> element is the child of the context node) Howard [1] http://www.w3.org/TR/xquery-use-cases/#xmp-data [2] http://www.w3.org/TR/xquery-use-cases/#xmp-data-q5 > > > > 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 18:24:05 UTC