Re: Selector Clarification

Hi Rahul,

> But, is using a '.' as the XPath expr. for a selector valid?
>
> The rec. says:
> http://www.w3.org/TR/xmlschema-1/#section-Identity-constraint-Definition-Validation-Rules
> [[
> 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. 
>
> ....
> ]]
>
> Looking at point 2 above, it reflects that, we cannot use '.' as the
> XPath expr. for a selector. Does *descendants of the context node*
> includes the context node?

Good point. I'd missed that. Usually, "descendants of the context
node" doesn't include the context node, so I guess that would be the
intention here.

> On the other hand the production rule for the XPath expr. for the
> selector allows '.' as a valid XPath expr.
> http://www.w3.org/TR/xmlschema-1/#coss-identity-constraint

Yes. This leaves us in a position where it's valid for a schema to
contain a selector that has the xpath ., but it's not valid for an
instance to contain an element that uses that identity constraint.

I'm not sure whether the intention of the WG was to allow identity
constraints to select the context node or to disallow it. None of the
implementations that I tested (XSV, MSXML, Xerces-C++, Xerces-J)
complained about using <xs:selector xpath="." />, either within the
schema or when there was an element in the instance document using the
identity constraint.

You really need confirmation from W3C. Messages to
www-xml-schema-comments@w3.org might elicit an official response.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 10 April 2002 02:42:10 UTC