I am trying to write an assertion that will make the values of @row
and @column
less than or equal to the values of @rows
and @columns
in the parent element <structure>
.
<xs:element name="structure">
<xs:complexType>
<xs:sequence>
<xs:element name="cell" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="row" type="xs:positiveInteger"/>
<xs:attribute name="column" type="xs:positiveInteger"/>
<xs:assert test="@row le @rows"/>
<xs:assert test="@column le @columns"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="rows" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="columns" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
</xs:element>
Are my assertions in the wrong place? What XPath expression do I use to specify the parent node? My editor isn't letting me write ..@rows
.
An assertion XPath cannot reach outside of its context.
So, move your assertion up to the
structure
element, and use anevery ... satisfies
assertion test: