Consider this XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Test">
<xs:complexType>
<xs:attribute name="X">
<xs:simpleType>
<xs:restriction>
<xs:enumeration value="One"/>
<xs:enumeration value="Two"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Y">
<xs:simpleType>
<!-- Choose how to restrict the value based on the value of the X attribute. -->
<xs:restriction base="if X=One then List1 else List2"/>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="List1">
<xs:restriction base="xs:string">
<xs:enumeration value="Option1"/>
<xs:enumeration value="Option2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="List2">
<xs:restriction base="xs:string">
<xs:enumeration value="Option3"/>
<xs:enumeration value="Option4"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
So for the attribute Test/@Y, I want to restrict the possible values based on the value of Test/@X. If X is One, then Y can must be in List1, otherwise, Y must be in List2. Is this possible?
Check this question about co-occurrence constraints: XSD: Define attributes based on the value of previous attribute
Summarizing: