W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2003

Restricting two attributes to be unequal

From: Brett Randall <brett_s_r@hotmail.com>
Date: Sat, 27 Sep 2003 04:07:12 +0000
To: xmlschema-dev@w3.org
Message-ID: <BAY2-F168IaHtF8zAOX00028242@hotmail.com>

Hi all,

I am wondering if the following is possible in XML Schema, and if so, how it 
can be done.  I have an element that is a complexType with two integer 
attributes "from" and "to" :

<xs:element name="myelement" maxOccurs="unbounded">

			<-- snip -->

		<xs:attribute name="from" use="required">
				<xs:restriction base="xs:integer"/>

		<xs:attribute name="to" use="required">
				<xs:restriction base="xs:integer"/>


What I would like to do firstly is to prevent attribute values "from" and 
"to" from being equal in documents based on this schema, forcing them to be 
unequal.  A unique or key won't do as I want to force uniqueness over two 

Out of interest, if I can force them to be unequal, can I also force 

I'm guessing I need some sort of attributeGroup?

Any help/guidance appreciated.


ninemsn Premium transforms your e-mail with colours, photos and animated 
text. Click here  http://ninemsn.com.au/premium/landing.asp
Received on Saturday, 27 September 2003 00:08:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:03 UTC