Re: XSV failing to detect keyref violation ?

Eric van der Vlist <vdv@dyomedea.com> writes:

> Hi,
> 
> I have written a 'simple' use case [1]&[2] where a keyref:
> 
> 	<xsd:key name="authorKey">
> 		<xsd:selector>author</xsd:selector>
> 		<xsd:field>name</xsd:field>
> 	</xsd:key>
> 
> 	<xsd:keyref refer="authorKey" name="book2author">
> 		<xsd:selector>book/author</xsd:selector>
> 		<xsd:field>text()</xsd:field>
> 	</xsd:keyref>
> 
> doesn't seem to detect any keyref violation through XSV [3].

XSV's support for XPath is limited, and doesn't include any
functions.  Having said that, your <field>text()</field> is not
actually correct:

  "{fields} specifies XPath expressions relative to each element
  selected by a {selector}. This must identify a single node
  (_element or attribute_, not necessarily within the selected
  element) whose content or value, which must be of a simple type, is
  used in the constraint." [emphasis added]

Replace 'text()' above with '.' and you'll be OK, and XSV gives the
desired effect:

<invalid char='3' code='cvc-identity-constraint.2.3.2' line='7' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/book1.xml'>no key in authorKey for Charles M. Schulzs</invalid>
<invalid char='3' code='cvc-identity-constraint.2.3.2' line='17' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/book1.xml'>no key in authorKey for Charles M. Schulzhghjg</invalid>


ht

[1] http://www.w3.org/TR/xmlschema-1/#Identity-constraint_Definition_details
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Thursday, 31 August 2000 06:40:10 UTC