Im very new to XML and i cant figure out how can I restrict one element to be always higher than another one. Here is the code
<xs:element name="limit" type="xs:integer"></xs:element>
<xs:element name="enrolled">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
How can I say, that element limit will be always higher than enrolled ( limit > enrolled ) ? I will be thankful for every help.
Your constraint cannot be expressed in XSD 1.0.
Use an xs:assert
on an ancestor element containing both limit
and enrolled
, e.g:
<xs:assert test="limit > enrolled"/>