You cannot do this in XSD.
Your best option is probably to create distinct elements <value1> and
<value2> and then have a choice
<xs:choice>
<xs:sequence>
<xs:element name="value1">
<xs:element name="element2">
<xs:element name="element3">
<xs:sequence>
<xs:sequence>
<xs:element name="value2">
<xs:element name="element4">
<xs:element name="element5">
<xs:sequence>
</xs:choice>
--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm [quoted text, click to view] "Sergey Poberezovskiy" <SergeyPoberezovskiy@discussions.microsoft.com> wrote
in message news:30A5003E-7654-4FB7-A44A-D52C29F02CB2@microsoft.com...
> Hi,
>
> I need to implement the following rule:
> Element el_1 is defined as follows:
>
> <xs:element name="el_1">
> <xs:restriction base="xs:string">
> <xs:enumeration value="value1"/>
> <xs:enumeration value="value2"/>
> <xs:enumeration value="value3"/>
> </xs:restriction>
> </xs:element>
>
> If in validated XML document el_1 = value1 then I need elements 2 and 3 to
> appear, otherwise - 4 and five. Something like:
>
> <xs:choice>
> <xs:sequence>
> <xs:element name="el_1" with_value="value1"/>
> <xs:element ref="el_2"/>
> <xs:element ref="el_3"/>
> </xs:sequence>
> <xs:sequence>
> <xs:element name="el_1" with_value!="value1"/>
> <xs:element ref="el_4"/>
> <xs:element ref="el_5"/>
> </xs:sequence>
> <xs:choice>
>
> I know that the code above is not valid, what I do not know - how to make
> it
> valid?
>
> Any help is appreciated.
>