W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2001

RE: Poorly researched observations on <xsd:key>, <xsd:keyref> and <xsd:unique>

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Fri, 9 Feb 2001 16:36:11 -0700
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08AA85@THOR>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Poorly researched on no sleep.

From Part 1, Section 3.10:
{selector} specifies an XPath expression [XPath] relative to instances of the element being declared. This must identify a node set of subelements (i.e. elements contained within the declared element)
to which the constraint applies.
---
Was this intentionally omitting the constrained element from the potential node set?  My previous message assumed that self or descendant-or-self would be legal though the target node set might
contain the constrained element.
For example, you might want to constrain the following document
<Profiles favorite="javaProfile">
	<Profile id="javaProfile">Java</Profile>
	<Profile id="cppProfile">C++</Profile>
</Profiles>
with a constraint like:
<xsd:key name="profileID">
	<xsd:selector xpath="Profile"/>
	<xsd:field xpath="@id"/>
</xsd:key>
<xsd:keyref name="favoriteProfile" refers="profileID">
	<xsd:selector xpath="."/>
	<xsd:field xpath="@favorite"/>
</xsd:keyref>
However, the keyref would not be legal with the current construct since the constrained node is not a subelement of itself.
Received on Friday, 9 February 2001 18:41:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT