This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3660 - Unclear what to do on external variable with no value
Summary: Unclear what to do on external variable with no value
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: Other Linux
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-06 16:06 UTC by Frans Englich
Modified: 2006-09-14 12:01 UTC (History)
0 users

See Also:


Attachments

Description Frans Englich 2006-09-06 16:06:09 UTC
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
Comment 1 Michael Kay 2006-09-06 19:24:07 UTC
>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.

For the record, XSLT also allows you to specify whether or not the parameter is required, and if it is optional, the default value. The error code applies only if the parameter is mandatory. Such facilities would be very useful in XQuery too!
Comment 2 Don Chamberlin 2006-09-14 00:19:28 UTC
Frans,
On Sept. 12, 2006, the Query Working Group decided that referencing an unbound external variable should raise error XPDY0002. Section 3.1.2 (Variable References) in the XQuery specification will be edited accordingly. If you are satisfied with this resolution, please change the status of this bug report to "Closed".
Regards,
Don Chamberlin (for the Query Working Group)