Itβs well known that XML Schema cannot do this,
checking an element based on another element is considered ambiguous, so this is not possible. But if you want, you can check the data type of both types, ignoring conditional validation, something like this:
Define a new data type with a custom name and copy the pattern below.
<xs:simpleType name="new_type"> <xs:restriction base="xs:string"> <xs:pattern value="(([0-9]+)[.]([0-9]+))|(([0][1-9]|[1][0-2])/([0][1-9]|[1-2][0-9]|[3][0-1])/[1-2][0-9][0-9][0-9])"/> </xs:restriction> </xs:simpleType>
This will accept data like decimal or date, but you cannot check it with attribute values,
An alternative solution is to use Schematron, but you will not get such a convenient and user-friendly tool for this, as you will get with XSD and XSLT.
source share