Reputation: 876
Considering below xml code
<panel col="2">
<label value="old password" />
<text id="oldPass" />
</panel>
now I want to declare a XSD file for above xml, and I want when panel's attribute col greater than zero, all of the elements inside it have special colspan attribute and when it is not true they don't have colspan attribute.
How can I achieve this goal?
Upvotes: 0
Views: 90
Reputation: 2110
In XSD 1.1, inside your complexType
of panel
you could use assertion
test
<xs:assert test="(@col > 0) and (./child::*[@colspan])"/>
<xs:assert test="(@col <= 0) and (count(./child::*[@colspan]) = 0)"/>
Upvotes: 2