<schema xmlns="http://www.ascc.net/xml/schematron" >
     <pattern name="Test count">
          <rule context="/*">
               <report test="count(//BBB) = count(//AAA)">O.K.</report>
               <assert test="count(//BBB) &lt;= count(//AAA)">Some AAA are missing</assert>
               <report test="count(//BBB) &lt; count(//AAA)">Some BBB are missing</report>
          </rule>
     </pattern>
</schema>