W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

Re: [Moderator Action] Restricting enumerations based on element/attribute value

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 09 Jan 2001 08:58:01 +0000
To: Jim.Schneider@Level3.com
Cc: xmlschema-dev@w3.org
Message-ID: <f5b4rz9t84m.fsf@cogsci.ed.ac.uk>
Jim.Schneider@Level3.com writes:

> Is there a way to restrict an enumeration list based on the value of some
> other element/attribute value?
> 
> For example (being new to XML schema, please forgive the syntax errors),
> given the example below, I would like to restrict the "LastName" attribute
> based on the value of the Party@Name attribute. In general, I would like
> "built-in" constraints/rules in my schema file. Is this possible? 
> -----------------------------------------------------------
> 
> <schema ...>
> <element name="Candidates">
>    <element name="Party">
>        <attribute name="Name" />
>     </element>
>    <element name="People">
>        <attribute name="LastName">
>           <simpleType>
>              <enumeration value="Reagan" />
>              <enumeration value="Bush" />
>              <enumeration value="Clinton" />
>              <enumeration value="Gore" />
>           </simpleType>
>        </attribute>
>    </element>
> </element>

Sorry, run-time type construction == (attribute) co-constraints are
not provided by XML Schema 1.0 -- they are high on everyone's
requirements list for the next version.

ht
-- 
  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 Tuesday, 9 January 2001 03:58:06 GMT

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