I have been searching the web for a while and from what I can tell what I want is not possible using XSD 1.0. My requirement is:
We have an .xml that create the following table when imported to excel:
The requirement is only one, that the values under Bird 1,2,3 are restricted from the range of each Min & Max of each feature.
For example the Bird 1 weight must be between 10-20 but the Bird 1 height to be between 3-9.
Under the Bird 3 the weight and height are not valid methods because they are outside their min-max range.
Now I need to make an XSD file that can be imported to Excel and that it create the restriction that make the above work.
The XSD i have made is:
xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="Row" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Feature"/>
<xs:element type="xs:int" name="Min"/>
<xs:element type="xs:int" name="Max"/>
<xs:element name="Bird 1">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="X"/> <!-- X= The Min value -->
<xs:maxInclusive value="Y"/> <!-- Y= The Max value -->
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Bird 2">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="X"/> <!-- X= The Min value -->
<xs:maxInclusive value="Y"/> <!-- Y= The Max value -->
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Bird 3">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="X"/> <!-- X= The Min value -->
<xs:maxInclusive value="Y"/> <!-- Y= The Max value -->
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The XSD above works only if in the restriction values we have fixed numbers.
Ideally I would like to have the restriction minInclusive and maxInclusive values pointing to the Min Max element.
If I could use XSD 1.1 or something else like schematron that would be feasible. But because I need the xsd to be imported to Excel I am forced to use XSD 1.0.
I am currently trying to figure out a way to do it with Key and Key-ref based on the example sample but so far I had no luck.
Any suggestion or workaround to make this work???
Thank you in advance