I am wondering if there is a way to restrict what validates using one element to check another element. In the example below, is it possible to check a restriction that if OptionOne is selected as "B", then RefIssue will have to be selected as "XXXX-B-XXX" and vice versa?
I have looked into key / refkey, but I was not able to figure out if it could do this constraint. Any help appreciated.
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="CustomIssueSchema"> <xs:complexType> <xs:sequence> <xs:element name="CustomIssue" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="CustomArgs" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="OptionOne"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="A"/> <xs:enumeration value="B"/> <xs:enumeration value="C"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="CustomRef" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="RefIssue"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="XXXX-A-XXX"/> <xs:enumeration value="XXXX-B-XXX"/> <xs:enumeration value="XXXX-C-XXX"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>