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 2125 - R-136: Question about selector XPath expressions
Summary: R-136: Question about selector XPath expressions
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.0 only
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Henry S. Thompson
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-09 16:05 UTC by Sandy Gao
Modified: 2009-04-21 19:25 UTC (History)
0 users

See Also:


Attachments

Description Sandy Gao 2005-09-09 16:05:07 UTC
Is the following invalid? 

<xsd:element name="root">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="Book" maxOccurs="unbounded">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="isbn" type="xsd:string"/>
          <xsd:sequence>
          <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:complexType>
        
        <xsd:key name="BookKey">
          <xsd:selector xpath="."/>
          <xsd:field xpath="isbn"/>
        <xsd:key>
        
      <xsd:element>
    <xsd:sequence>
  <xsd:complexType>
<xsd:element>
The point to note here is that the selector XPath contains the expr '.' 

The XMLSchema Rec says:

[[ {selector} specifies a restricted XPath ([XPath]) expression relative to 
instances of the element being declared. This must identify a node set of 
subordinate elements (i.e. contained within the declared element) to which the 
constraint applies.

]] 

Further, 3.11.4 The Identity-constraint Definition Validation Rules, states:

[[ Validation Rule: Identity-constraint Satisfied 

For an element information item to be locally valid with respect to an identity-
constraint all of the following must be true:

1 The {selector}, with the element information item as the context node, 
evaluates to a node-set (as defined in [XPath]). [Definition:] Call this the 
target node set. 

2 Each node in the target node set is an element node among the descendants of 
the context node.

3 ....

]] 

Looking at point 2 above, it reflects that, '.' cannot be used as the XPath 
expr for a selector. Does *descendants of the context node* include the context 
node? 

On the other hand the production rule for the XPath expr for the selector 
allows '.' as a valid XPath expr. 

A clarification is requested.

See:
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002AprJun/0014.html
Comment 1 Sandy Gao 2005-09-09 16:17:21 UTC
Henry's response:
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002AprJun/0024.html

Resolution:
Discussed at the May 23 telecon:
http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2002May/0091.html 

Resolved to classify R-136 as an error and instruct editor to draft erratum.

Proposed text:
http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2002Oct/att-0225/01-R-
161etc.html

Reviewed and approved at the Oct. 24 telecon. See:
http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2002Oct/0248.html 

Erratum E1-35 added.