W3C Schema 1.0 does not have the ability to limit attribute values โโbased on an instance document.
Schematron is a great tool for verifying that documents adhere to such custom validation scripts.
For example:
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://purl.oclc.org/dsdl/schematron"> <pattern> <rule context="root[@children]"> <assert id="children-value" test="@children=count(child)" flag="error"> The root/@children value must be equal to the number of child elements. </assert> </rule> </pattern> </schema>
Mads hansen
source share