Changes between Initial Version and Version 1 of GeneralComponentSchemaSchematron


Ignore:
Timestamp:
04/10/12 14:12:15 (12 years ago)
Author:
twagoo
Comment:

Created page, overview of proposed schematron rules

Legend:

Unmodified
Added
Removed
Modified
  • GeneralComponentSchemaSchematron

    v1 v1  
     1= General component schema Schematron rules =
     2
     3This page concerns a proposal to extend the [source:/metadata/trunk/toolkit/general-component-schema.xsd general component schema] with a number of [http://www.schematron.com/ Schematron] rules to specify certain restrictions that cannot be expressed using plain XSD.
     4
     5Currently a version of this extended schema can be found as a part of the testing resources of the CMDValidate library of the [[ComponentRegistryAndEditor|ComponentRegistry]]:
     6
     7* [source:/ComponentRegistry/trunk/CMDValidate/src/test/resources/schema/general-component-schema.xsd general component schema extended with schematron rules]
     8
     9== Restrictions ==
     10
     11=== Sibling components or elements should all have a different name ===
     12
     13{{{
     14#!xml
     15<sch:pattern id="component" name="CMD component group">
     16    <sch:rule context="CMD_Component|CMD_Element">
     17        <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>
     18    </sch:rule>
     19</sch:pattern>
     20}}}
     21
     22=== Attribute name shouldn't be 'ref' or '!ComponentId' ===
     23
     24{{{
     25#!xml
     26<sch:pattern id="attribute" name="CMD attribute">
     27    <sch:rule context="Attribute">
     28        <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>
     29        <sch:assert test="not(Name=('ref','ComponentId'))">Attribute name shouldn't be 'ref' or 'ComponentId', as these are used internally by CMD!</sch:assert>
     30    </sch:rule>
     31</sch:pattern>
     32}}}
     33
     34=== All items in an enumeration should be different ===
     35{{{
     36#!xml
     37<sch:pattern id="item" name="CMD enumeration item">
     38    <sch:rule context="item">
     39        <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>
     40    </sch:rule>
     41</sch:pattern>
     42}}}