<xs:element maxOccurs="1" minOccurs="0" name="lower" type="sdc4:InvlType"><xs:annotation><xs:documentation xml:lang="en-us">The lower boundary of the interval. Must be of the same datatype as the 'upper' boundary.</xs:documentation></xs:annotation></xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="upper" type="sdc4:InvlType"><xs:annotation><xs:documentation xml:lang="en-us">The upper boundary of the interval. Must be of the same datatype as the 'lower' boundary.</xs:documentation></xs:annotation></xs:element>
not(exists(lower) and exists(upper)) or (name(lower/*) eq name(upper/*))
Source
<xs:complexType name="XdIntervalType"><xs:annotation><xs:documentation xml:lang="en-us">A generic type for defining an interval (i.e., range) of ordered values. It is primarily used to define reference ranges for quantified data.</xs:documentation><xs:appinfo><rdf:Description rdf:about="https://semanticdatacharter.com/ns/sdc4/sdc4.xsd#XdIntervalType"><rdfs:subClassOf rdf:resource="https://semanticdatacharter.com/ns/sdc4/sdc4.xsd#XdAnyType"/></rdf:Description></xs:appinfo></xs:annotation><xs:complexContent><xs:extension base="sdc4:XdAnyType"><xs:sequence><!-- The 'lower' and 'upper' bounds now correctly use InvlType --><xs:element maxOccurs="1" minOccurs="0" name="lower" type="sdc4:InvlType"><xs:annotation><xs:documentation xml:lang="en-us">The lower boundary of the interval. Must be of the same datatype as the 'upper' boundary.</xs:documentation></xs:annotation></xs:element><xs:element maxOccurs="1" minOccurs="0" name="upper" type="sdc4:InvlType"><xs:annotation><xs:documentation xml:lang="en-us">The upper boundary of the interval. Must be of the same datatype as the 'lower' boundary.</xs:documentation></xs:annotation></xs:element><xs:element maxOccurs="1" minOccurs="1" name="lower_included" type="xs:boolean" default="true"/><xs:element maxOccurs="1" minOccurs="1" name="upper_included" type="xs:boolean" default="true"/><xs:element maxOccurs="1" minOccurs="1" name="lower_bounded" type="xs:boolean" default="true"/><xs:element maxOccurs="1" minOccurs="1" name="upper_bounded" type="xs:boolean" default="true"/><xs:element maxOccurs="1" minOccurs="0" name="interval-units" type="sdc4:InvlUnits"/></xs:sequence><!--
================== XSD 1.1 ENHANCEMENT ==================
This assertion guarantees that the datatypes chosen for the
lower and upper bounds are identical, preventing invalid intervals
like having a date for the lower bound and an integer for the upper.
It checks that the element names inside 'lower' and 'upper' match.
This assertion correctly handles all cases, including unbounded intervals.
It only performs the type check if BOTH 'lower' and 'upper' exist.
If either is missing, the assertion passes.
===========================================================
--><xs:assert test="not(exists(lower) and exists(upper)) or (name(lower/*) eq name(upper/*))"/></xs:extension></xs:complexContent></xs:complexType>