[Bug 3660] Unclear what to do on external variable with no value

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

           Summary: Unclear what to do on external variable with no value
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: frans.englich@telia.com
         QAContact: public-qt-comments@w3.org


What is an implementation supposed to do on this query?

    declare variable $thisVarIsNotRecognized external;
    $thisVarIsNotRecognized

In 4.14 Variable Declaration it is asserted that "If the variable declaration
includes the keyword external, a value must be provided for the variable by the
external environment before the query can be evaluated." Note the
assertion("must") and the absence of an instruction on what to do if the
assertion does not hold.

It seems XSL-T 2.0 handles this with a specific error code,
XTDE0050(http://www.w3.org/TR/xslt20/#err-XTDE0050). This is actually what
Saxon raises, which demonstrates the lack of coverage in the XQTS and probably
also the specification.

I don't see how XPST0008 is supposed to be raised, since 4.14 Variable
Declaration reads "A variable declaration adds the static type of a variable to
the in-scope variables".

It seems that an error code is needed for when a lookup fails in the 'variable
values'(dynamic context property) since the same paragraph says "and may also
add a value for the variable to the variable values".

Therefore, with my current view on this, I suggest adding an error code that:

* Must be raised if a variable reference to an external variable does not have
a corresponding value in the 'variable values'.
* May be raised statically when encountering an external variable declaration
that the external environment doesn't have a value for.

The latter point ensure the 1) error can be consistently reported regardless of
if the variable is used; 2) allow implementations to report the error without
tracking use; and 3) still allows implementations to report it at runtime.


Frans

Received on Wednesday, 6 September 2006 16:06:26 UTC