>> English << | českyZVON > Tutorials > Schematron Tutorial
>> Example 12 << | Prev | Next | Contents

Description

Value of the attribute is two or three character abbreviation.

Schema


<schema xmlns="http://www.ascc.net/xml/schematron" >
     <pattern name="Number of characters in an abbreviation">
          <rule context="BBB">
               <report test="string-length(@bbb) &lt; 2">There is not enough letters in the abbreviation</report>
               <report test="string-length(@bbb) > 3">There is too much letters in the abbreviation</report>
          </rule>
     </pattern>
</schema>

Sources and outputs

Source (XML 1)Output

<AAA>
     <BBB bbb="C"/>
</AAA>
 Pattern: Number of characters in an abbreviation
/AAA/BBB: There is not enough letters in the abbreviation


Source (XML 2)Output

<AAA>
     <BBB bbb="CZ"/>
</AAA>
 Pattern: Number of characters in an abbreviation


Source (XML 3)Output

<AAA>
     <BBB bbb="CZCZ"/>
</AAA>
 Pattern: Number of characters in an abbreviation
/AAA/BBB: There is too much letters in the abbreviation