W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2006

Predicates in xpath expressions in <xs:selector>

From: Fermín Galán Márquez <fermin.galan@cttc.es>
Date: Sat, 7 Oct 2006 18:30:13 +0200
To: <xmlschema-dev@w3.org>
Message-ID: <001201c6ea2d$ddc4d4d0$303d5854@cttc.es>

Hi,

I'm experiencing problems using predicates in xpath attribute in
<xs:selector> XMLSchema elements and I wonder if this is a problem of the my
validator (xerces) or a limitation in the XMLSchema specification itself.

To detail the problem, let's consider a element (<item>) with a type
attribute. The type attribute has two allowable values: "type1" and "type2".
Element <item> has an additional name attribute, that must be unique in each
"type-partition". I mean, the following is allowed:

<item type="type1" name="n1" />
<item type="type1" name="n2" />
<item type="type2" name="n1" />
<item type="type2" name="n2" />

but this is forbidden:

<item type="type1" name="n1" />
<item type="type1" name="n1" />

I'm trying to define the uniqueness with (in the parent <xs:element> of
item):

<xs:unique name="uniquiness1">
   <xs:selector xpath="item[@type='type1']" />
   <xs:field xpath="@name"/>
</xs:unique>
<xs:unique name="uniquiness2">
   <xs:selector xpath="item[@type='type2']" />
   <xs:field xpath="@name"/>
</xs:unique>

But, when trying to use this XMLSchema for validation, the validator tells:
'Xpath token not supported'

Is a problem of the validator or I'm trying to do something imposible with
XMLSchema? Any clarification is welcome...

Thanks in advace!

Best regards,

--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12 
Fax : +34 93 645 29 01
Email address: fermin.galan@cttc.es 

PD. I've detected the problem in <xs:unique> but I suppose that the same
applies to <xs:key>
Received on Saturday, 7 October 2006 16:30:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:55 GMT