conditional restriction in schema?

A

Andrew L

Hello all,

I'm new to XML schema design, and I've got a problem which I need some help
with. I have a simple type which describes a list of valid categories. I
also have another type which describes a list of all known subcategories.
However only a subset of the subcategories will be valid and this depends
on the value of the main category.
eg If category is cat1, then the only valid subcategories are scat1, scat2.
How and where can I put in a conditional operator in my schema?

<xs:simpleType name="category">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="cat1"/>
<xs:enumeration value="cat2"/>
<xs:enumeration value="cat3"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="category">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="scat1"/>
<xs:enumeration value="scat2"/>
<xs:enumeration value="scat3"/>
<xs:enumeration value="scat4"/>
<xs:enumeration value="scat5"/>
</xs:restriction>
</xs:simpleType>

Many thanks for your help

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top