General component schema Schematron rules
This page concerns a proposal to extend the general component schema with a number of Schematron rules to specify certain restrictions that cannot be expressed using plain XSD.
Currently a version of this extended schema can be found as a part of the testing resources of the CMDValidate library of the ComponentRegistry:
Restrictions
Sibling components or elements should all have a different name
<sch:pattern id="component" name="CMD component group"> <sch:rule context="CMD_Component|CMD_Element"> <sch:assert test="empty(preceding-sibling::*[@name=current()/@name])">Sibling components or elements should all have a different name. Found multiple components or elements named '<sch:value-of select="@name"/>'!</sch:assert> </sch:rule> </sch:pattern>
Attribute name shouldn't be 'ref' or 'ComponentId'
<sch:pattern id="attribute" name="CMD attribute"> <sch:rule context="Attribute"> <sch:assert test="empty(preceding-sibling::Attribute[Name=current()/Name])">All attributes in an attribute list should have a different name. Found multiple attributes named '<sch:value-of select="Name"/>'!</sch:assert> <sch:assert test="not(Name=('ref','ComponentId'))">Attribute name shouldn't be 'ref' or 'ComponentId', as these are used internally by CMD!</sch:assert> </sch:rule> </sch:pattern>
All items in an enumeration should be different
<sch:pattern id="item" name="CMD enumeration item"> <sch:rule context="item"> <sch:assert test="empty(preceding-sibling::item[.=current()])">All items in an enumeration should be different. Found multiple items with value '<sch:value-of select="."/>'!</sch:assert> </sch:rule> </sch:pattern>
Last modified 12 years ago
Last modified on 04/10/12 14:12:15