Bug 19257 - [XQ3.0] Context item must be a singleton
[XQ3.0] Context item must be a singleton
Status: CLOSED FIXED
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.0
Last Call drafts
PC All
: P2 normal
: ---
Assigned To: Jonathan Robie
Mailing list for public feedback on specs from XSL and XML Query WGs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-03 17:16 UTC by Michael Kay
Modified: 2013-06-19 09:31 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kay 2012-10-03 17:16:29 UTC
In 4.17, Context item declaration, the specification does not make it clear what happens if the initial value of the context item evaluates to (a) an empty sequence, or (b) a sequence containing more than one item. 

The second case is clearly an error, and we need to say so.

The first case is either an error, or results in the context item being "absent" and therefore unusable.
Comment 1 Jonathan Robie 2012-10-05 21:32:59 UTC
I agree. I would prefer to make both cases errors.
Comment 2 Tim Mills 2012-10-07 19:00:54 UTC
It must surely be XPTY0004 since the context item type can only be specified as an item (not sequence) type by virtue of the grammar

[31]   	ContextItemDecl	   ::=   	"declare" "context" "item" ("as" ItemType)? ((":=" VarValue) | ("external" (":=" VarDefaultValue)?))

and is effectively

declare context item as item() external;

when not explicitly declared.
Comment 3 Ghislain Fourny 2012-10-09 15:45:56 UTC
I tend to agree with Tim. I think it can be logically inferred from the current specification that a type error will be raised in both cases. Perhaps a note saying so might make this clearer though?
Comment 4 Jonathan Robie 2012-10-09 15:48:31 UTC
The Working Group agrees. I will make the changes in comments 0, 1, and 2.