views:

13

answers:

1

Hey all,

Quick question, i know i can choice elements, so one or the other is required, that's grand.

Is it possible to do that with Attributes? Simple sample...

<xs:element name="date" minOccurs="1" maxOccurs="unbounded">
  <xs:complexType>
    <xs:choice>
      <xs:attribute name="monthid" type="id" use="optional" />
      <xs:attribute name="weekendid" type="id" use="optional" />
    </xs:choice>
  </xs:complexType>
</xs:element>

From what i've been reading, it's not possible... but i could be wrong!

A: 

http://stackoverflow.com/questions/763072/xsd-one-of-2-attributes-is-required

Nevermind, I found the answer. That'll teach me to look first.

Dean Thomas
You're right. However, you might want to look at using Schematron annotations as an adjunct to XSD
Nic Gibson