xml - Child's attribute depends on parent's attribute in XSD -
considering below xml code
<panel col="2"> <label value="old password" /> <text id="oldpass" /> </panel>
now want declare xsd file above xml, , want when panel's attribute col greater zero, of elements inside have special colspan attribute , when not true don't have colspan attribute.
how can achieve goal?
in xsd 1.1, inside complextype
of panel
use assertion
test
<xs:assert test="(@col > 0) , (./child::*[@colspan])"/> <xs:assert test="(@col <= 0) , (count(./child::*[@colspan]) = 0)"/>
Comments
Post a Comment