[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
Predicates in xpath expressions in <xs:selector>

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

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.