<div dir="ltr"><div>Frank,</div><div><br></div><div>There is an interesting feature of Schematron's design useful in a case like yours, namely that within a pattern, only one rule may apply to any element, and the first rule wins.</div><div><br></div><div>This means we can pre-empt the application of rules by writing other rules.</div><div><br></div><div>For example:</div><div><br></div><div>
 <sch:pattern id="Check_LI"></div><div><br></div><div>  <sch:rule context="*[exists(@conref)]//li | li[exists(@conref)]"/><br></div><div>  <sch:rule context="li"></div><div>    <sch:assert test="exists(*)">li must have children</sch:assert></div><div>  </sch:rule><br></div><div>
    <p></sch:pattern></p>

</div><div>The second rule says "an li must have children". The first rule intervenes for li elements that have @conref or an ancestor with @conref - it does no checking so it is silent.</div><div><br></div><div>Try it and see how it goes --</div><div><br></div><div>Cheers, Wendell</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 22, 2023 at 7:35 AM Frank Dissinger <<a href="mailto:frank.dissinger@cgs-oris.com">frank.dissinger@cgs-oris.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  

    
  
  <div>
    <p>Hi all,</p>
    <p><br>
    </p>
    <p>I need a Schemtron rule which indicates an error when <li>
      elements do not have any child elements. No error schould be
      indicated for <li> elements with an "conkeyref" attribute
      and also for <li> elements which are children of any element
      with a "conkeyref" attribute.</p>
    <p><br>
    </p>
    <p>I have defined two separate rules...<br>
    </p>
    <p><br>
    </p>
      <sch:pattern id="Check_LI2"><br>
        <sch:rule context="<b>li[not(@conkeyref)]</b>"><br>
          <sch:assert test="*">List does not contain any child
    elements</sch:assert><br>
        </sch:rule><br>
      </sch:pattern><br>
    <br>
      <sch:pattern id="Check_LI3"><br>
        <sch:rule context="<b>li[not(parent::*[@conkeyref])]</b>"><br>
          <sch:assert test="*">List does not contain any child
    elements</sch:assert><br>
        </sch:rule><br>
    <p>  </sch:pattern></p>
    <p><br>
    </p>
    <p>... but I think I need to combine them into a single rule with an
      OR or AND operator.</p>
    <p><br>
    </p>
    <p>  <sch:pattern id="Check_LI3"><br>
          <sch:rule context="<b>li[not(@conkeyref)]</b> <b><font color="#ff0000">OR </font></b><b>li[not(parent::*[@conkeyref])]
      </b>"><br>
            <sch:assert test="*">List does not contain any child
      elements</sch:assert><br>
          </sch:rule><br>
    </p>
    <p>  </sch:pattern></p>
    <p><br>
    </p>
    <p>However, this syntax is invalid. Can somebody help me?</p>
    <p><br>
    </p>
    <p>Regards,</p>
    <p>Frank<br>
    </p>
    <div>-- <br>
      
      
      <div>
        
        <div>
          <div>
            <p><strong>Frank Dissinger</strong></p>
            <p>Documentation Manager</p>
            <p>....................................................................</p>
          </div>
          <div>
            <p><strong>CGS Publishing Technologies International GmbH</strong></p>
            <p><strong>Email </strong><a href="mailto:frank.dissinger@cgs-oris.com" target="_blank">frank.dissinger@cgs-oris.com</a>
              | <strong>Web</strong> <a href="http://www.cgs-oris.com/" target="_blank">www.cgs-oris.com</a></p>
            <p><strong>Address</strong> Kettelerstr. 24 | D-63512
              Hainburg | Germany</p>
            <p><strong>Phone</strong> +49 6182 9626-27 | <strong>Fax</strong>
              +49 6182 9626-99</p>
            <p><strong>Commercial register</strong> Offenbach, HRB no.
              21495</p>
            <p><strong>Managing directors</strong> Bernd Rückert,
              Christoph Thommessen</p>
            <p><br>
            </p>
            <a href="https://www.cgs-oris.com/signatur" target="_blank"><img alt="https://www.cgs-oris.com/Signatur.png" longdesc="https://ci5.googleusercontent.com/proxy/2RxgE_bz8y_YuSCRvsnCRi_LlIYqXtYPaqp3HrPDk-2GOXRN5oH-RsxV8eInm6y6Z2h5sg=s0-d-e1-ft#https://www.cgs-oris.com/signatur" src="https://www.cgs-oris.com/Signatur.png" width="394" height="200"></a> </div>
        </div>
      </div>
    </div>
  </div>
_______________________________________________<br>
oXygen-user mailing list<br>
<a href="mailto:oXygen-user@oxygenxml.com" target="_blank">oXygen-user@oxygenxml.com</a><br>
<a href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user" rel="noreferrer" target="_blank">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">...Wendell Piez... ...wendell -at- nist -dot- gov...<br>...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...<br>...<a href="http://github.com/wendellpiez." target="_blank">github.com/wendellpiez.</a>.. ...gitlab.coko.foundation/wendell... </div>