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

Description

Specification of required attribute

Schema


<schema xmlns="http://www.ascc.net/xml/schematron" >
     <pattern name="Attribute test">
          <rule context="CCC">
               <assert test="@name">attribute name is not present</assert>
               <report test="@name">attribute name is present</report>
          </rule>
     </pattern>
</schema>

Sources and outputs

Source (XML 1)Output

<AAA>
     <BBB>
          <CCC/>
          <CCC/>
     </BBB>
     <CCC name="c1"/>
     <CCC name="c2"/>
</AAA>
 Pattern: Attribute test
/AAA/BBB/CCC[1]: attribute name is not present
/AAA/BBB/CCC[2]: attribute name is not present
/AAA/CCC[1]: attribute name is present
/AAA/CCC[2]: attribute name is present