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 12127 - "Root element" in assertion testing
Summary: "Root element" in assertion testing
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2011-02-18 20:41 UTC by Michael Kay
Modified: 2011-03-04 23:54 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2011-02-18 20:41:19 UTC
The specification states in part 1, 3.1.31, "To check an assertion, an instance of the XPath 2.0 data model ([XDM]) is constructed, in which the element information item being ·assessed· is the root element..."

The term "root element" here is unfortunate. XML 1.0 uses the term for the outermost element of a document. XDM does not use the term. Saxon's reading of the spec is that the element becomes the root node of a tree (and is therefore parentless). Judging from test d4_3_14v14, IBM's interpretation is that the element becomes the outermost element in a tree whose root is a document node, the document node being the parent of this element. In consequence, the test 

count(//ele1) eq 1

raises a dynamic error (and hence returns false) in Saxon, because an expression beginning "/" or "//" cannot be used when the context item is in a tree whose root is not a document node.
Comment 1 Mukul Gandhi 2011-02-19 03:31:01 UTC
I agree with Mike that this particular ambiguity is obvious.

Here's a quick proposal to resolve this ambiguity,

1) We may change description in section "3.13.1 The Assertion Schema Component" somewhat and the new wording might be:
"To check an assertion, an instance of the XPath 2.0 data model ([XDM]) is constructed, in which the element information item being ·assessed· is the context item of the XPath 2.0 dynamic context, and elements and attributes ..."

instead of the phrase cited by Mike. This then also becomes consistent with section "3.13.4.2 XPath Evaluation" of the spec which says:
1 The context item is E.

2) We modify the test case cited by Mike to have the expression,
count(.//ele1) eq 1

instead of,
count(//ele1) eq 1

Thanks.
Comment 2 David Ezell 2011-02-25 16:33:41 UTC
RESOLVED: editors to draft wording that makes clear that the subtree is rooted in a parentless element.
Comment 3 C. M. Sperberg-McQueen 2011-03-04 04:15:25 UTC
Proposal for bug 12127:  

In section 3.13.1 The Assertion Schema Component, 
in the sentence

   To check an assertion, an instance of the XPath 2.0 data 
   model ([XDM]) is constructed, in which the element information 
   item being ·assessed· is the root element, and elements and 
   attributes are assigned types and values according to XPath 
   2.0 data model construction rules, with some exceptions.

replace "root element" with "(parentless) root node".

No other change required; the detailed XDM construction rules
further on in the section are already clear that the node has no
parent.
Comment 4 David Ezell 2011-03-04 16:28:16 UTC
RESOLVED:  adopt the wording in comment #3.
Comment 5 C. M. Sperberg-McQueen 2011-03-04 23:02:44 UTC
The change proposal in comment 3 has now been integrated into the status-quo document.

Michael, as the originator please check the resolution and close or reopen the issue; thanks!