我想问一下,如果某个元素没有使用XPath查询的属性,有人知道如何进行XSD 1.1条件类型赋值检查,例如:
<!--inline alternative type definitions -->
<element name="TimeTravel" type="TravelType">
<alternative test="@direction='Future'">
<complexType>
<complexContent>
<restriction base="TravelType"
....
<!-- some past travel related elements go here -->
</complexType>
</alternative>
<alternative test="@direction='Past'">
<complexType>
<complexContent>
<restriction base="TravelType"
....
<!-- some future travel related elements go here -->
</complexType>
</alternative>
</element>
OR
<!--Named alternative type definitions -->
<element name="TimeTravel" type="TravelType">
<alternative test="@direction='Future' type="FutureTravelType"/>
<alternative test="@direction='Past' type="PastTravelType"/>
</element>
Run Code Online (Sandbox Code Playgroud)
在此示例中,'alternative test =""'检查TimeTravel元素的属性"direction"是否具有值"Future"或"Past".我应该如何编写XPath查询以检查例如当前元素是否没有"direction"属性?