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

RE: different attribute value sets for the same element ref?

From: Giles Hogben <giles.hogben@jrc.it>
Date: Mon, 14 Apr 2003 13:32:39 +0200
To: <xmlschema-dev@w3.org>
Message-ID: <GAEKIJGJBJOBBJEFAHMLAEMFCIAA.giles.hogben@jrc.it>

Thanks - I am still unsure whether it is correct syntax to create this
restriction below a reference to an element (and also below a reference to
an attribute)

Is it?

> I thought about doing it something like this:
>
> <xs:element name="home">
>     <xs:element ref="category">
>         <xs:attribute ref="name">
               <xs:simpleType>
      		<xs:restriction base="xs:token">
       			<xs:enumeration value="X" />
        			<xs:enumeration value="Y" />
        			<xs:enumeration value="Z" />
      		</xs:restriction>
    </xs:simpleType>
>         </xs:attribute>
>     </xs:element>
> </xs:element>
>
> but I can't figure out how it should go.

In XML Schema choices between values are provided by restricting the
relevant simple type with enumerated values, as follows:

  <xs:attribute name="name">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="X" />
        <xs:enumeration value="Y" />
        <xs:enumeration value="Z" />
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 14 April 2003 07:30:12 GMT

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