This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Hello! I'm using a version of the test suite taken from the CVS about a week ago. I might be misusing it, I apologize if that's the case. Test case “K2-NameTest-84” (in cat/NameTest.xml) reads: (:*******************************************************:) (: Test: K2-NameTest-84 :) (: Written by: Frans Englich :) (: Date: 2007-11-22T11:31:21+01:00 :) (: Purpose: Axis names are reserved function names. :) (:*******************************************************:) declare default function namespace "http://www.example.com/"; declare function element() { 1 }; element() (: end test case quote :) The test case expects the error XPST0003 (i.e., the expression is not a valid instance of the XQuery grammar), but does not cite any spec for that. I fail to find anything relevant in both the XQuery 1.0 and 1.1 (draft) specs. As far as I can tell, Appendix 3 “Reserved Function Names” (in both specs) refers only to function calls. Furthermore, it does not actually specify an interdiction but an impossibility: it only disambiguates the grammar, which is why there is no error code given. Production “FunctionDecl” (number 26 in 1.0 and 32 in 1.1) doesn't have the “reserved-function-names” annotation. The extra-grammatical constraint specifies that “it is not legal syntax for a user to invoke functions with unprefixed names which match any of the names in A.3”. (Note that this specifically says “invoking”, not “declaring”, a function.) By my reading, the query above defines the function “element” in namespace “http://www.example.com”, and then goes on and returns the value of “./child::element()” (i.e., the body is a PathExpr consisting of a single AbbrevForwardStep with an ElementTest). The correct error code would be XPDY0002, since the context element is not defined; however, one supposes that's not what the test case attempts to test. The syntax error expected could only arise if the function's arity would be greater than zero, and it were called with an argument that is not a QName. Note that while the function cannot be called in the test case as written, a function declared with an unprefixed but reserved name can actually called, for instance as below: (: example :) declare default function namespace "http://www.example.com/"; declare namespace NS = "http://www.example.com/"; declare function element() { 1 }; NS:element() (: end example :) I suggest to change the test to the following: (: suggestion :) declare default function namespace "http://www.example.com/"; declare function element($arg) { $arg }; element(1) (: end example :)
I think you're right actually. Saxon, QtXmlPatterns(implemented by me), and X-Hive disagrees with your interpretation, but considering that reserved-function-names doesn't apply to FunctionDecl as you point out, I agree. Mike, you got an objection or have Bogdan found a slew of (minor) bugs?
Yes, I suspect Bogdan's reasoning is correct.
This should be fixed in CVS.
In the XQTS catalog file for this test (NameText.xml), the scenario for this test is still parse-error, so needs fixing.
I agree with Tim in comment #5.
See also bug #8713. I think the spec needs clarifying: there's nothing in App.3 that says it refers only to function calls and not to function declarations, though there is circumstantial evidence elsewhere that that was intended. I don't really care much which way the decision goes.
According to Bug 8713 comment #3, "Our intent in 1.0 was to disallow such names in both function declarations and invocations. We will revise the 1.0 tests to allow either error or success."
XPST0003 added as baseline in CVS.