[Bug 5224] Dynamic context in global variable initializers

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5224

           Summary: Dynamic context in global variable initializers
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


There seems to be no statement in XQuery that says whether the context item,
position, and size are defined when referenced within the initializing
expression of a global variable.

There is an explicit statement that they are undefined in a function body, but
there is no parallel statement for variables.

There are two possible interpretations (a) the context item is undefined, and
(b) the context item is the context item supplied externally when the query is
initiated.

Section 2.4.4 says: "An expression can access input data either by calling one
of the input functions or by referencing some part of the dynamic context that
is initialized by the external environment, such as a variable or context
item.", and since neither this nor anything else rules out the expression in a
global variable initializer, one might infer that the externally-supplied
context item is accessible here. XSLT users might also assume that XQuery will
behave the same way as XSLT (which would make the external context item
available). 

However, I think there is really nothing in the spec that says which way the
language is intended to work, and either interpretation is currently possible.

I don't have strong views on which way it should work, just that it should be
well defined.

Received on Wednesday, 24 October 2007 14:39:41 UTC