[xquery-talk] context item in module variable

Michael Kay mike at saxonica.com
Sun Oct 13 15:18:26 PDT 2013

It would be useful to identify the test in question so we can see what its dependencies are, and whether the test results have been challenged. Presumably the test metadata identifies an environment which includes a definition of the value of the initial context item for tests using that environment.

The basic principle is that the initial context for execution of a query is implementation-defined, but in some cases there is quite a strong expectation that the query engine will provide an API that makes it user-defined; certainly, the design of QT3 assumes that implementations will provide a way to set the context item for a query.

The test suite documentation says this: "Also: XQuery and XPath do not explicitly require implementations to provide a way for all values in the static and dynamic context to be set. For example, an implementation that does not allow any collations to be defined (other than the Unicode Codepoint Collation) would be technically conformant; so also would be an implementation in which the default collection is always an empty sequence. There is therefore an implicit dependency, when values are set in the environment, that the implementation allows such values to be set. An implementation that cannot set the context as required should behave in the same way as if a dependency has not been satisfied, ideally reporting the test as "notRun" with a reason."

In other words, it is recognized that some tests are dependent on features which not every implementation is required to provide. One of these is the ability for a calling application to set the initial context item. Where tests depend on optional features that an implementation does not provide, the implementation should not run that test, and if results are submitted to W3C, the result for that test should be documented as "notRun" with a reason.

Michael Kay

On 13 Oct 2013, at 14:07, Benito van der Zander wrote:

> Hi,
> what is the value of the context item in a variable declaration of an module in XQuery 1?
> Since the spec says "The context item, position, and size in the dynamic context of the initializing expression have initial values as described in C.2 Dynamic Context Components." where it says "Default initial value = none", it should be undefined.
> But the new XQTS has a test
>  module namespace context="http://www.xqsharp.com/test/context";
>  declare variable $context:item := .;
> where it is then tested for not undefined...
> Benito
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list