[Bug 2125] R-136: Question about selector XPath expressions

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2125

           Summary: R-136: Question about selector XPath expressions
           Product: XML Schema
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSD Part 1: Structures
        AssignedTo: ht@w3.org
        ReportedBy: sandygao@ca.ibm.com
         QAContact: www-xml-schema-comments@w3.org


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

Received on Friday, 9 September 2005 16:05:14 UTC