<div style="font-family: Arial, sans-serif; font-size: 14px;">I meant the context attribute of course.</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">I can also silence the warning by defining a variable holding the appropriate elements and using the variable in my rules. This is what I will do in practice. It does look broken to me though.</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Thanks,</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">-- <br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Danny MacMillan<br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div>
<div class="protonmail_signature_block" style="font-family: Arial, sans-serif; font-size: 14px;">
    <div class="protonmail_signature_block-user protonmail_signature_block-empty">
        
            </div>
    
            <div class="protonmail_signature_block-proton">
        Sent with <a target="_blank" href="https://proton.me/" rel="noopener noreferrer">Proton Mail</a> secure email.
    </div>
</div>
<div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div class="protonmail_quote">
        ------- Original Message -------<br>
        On Monday, May 15th, 2023 at 10:36, Danny MacMillan <dm-bulk-oxygenxml@mail-eh.ca> wrote:<br><br>
        <blockquote class="protonmail_quote" type="cite">
            <div style="font-family: Arial, sans-serif; font-size: 14px;">Hello,</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Consider the following XML:</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span><?xml version="1.0"?></span><div><span><root></span></div><div><span>  <relevant></span></div><div><span>    <element relevant-attribute="this attribute exists only on elements under relevant"/></span></div><div><span>  </relevant></span></div><div><span>  <irrelevant></span></div><div><span>    <element/></span></div><div><span>  </irrelevant></span></div><div><span></root></span></div><div><span><br></span></div><span></span></div><div style="font-family: Arial, sans-serif; font-size: 14px;">And the following Schematron:</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span><?xml version="1.0" encoding="UTF-8"?></span><div><span><schema xmlns="<a href="http://purl.oclc.org/dsdl/schematron" rel="noreferrer nofollow noopener" target="_blank">http://purl.oclc.org/dsdl/schematron</a>" queryBinding="xslt3" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/1999/XSL/Transform</a>" xmlns:map="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"></span></div><div><span>  <ns prefix="map" uri="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"/></span></div><div><span>  <let name="some-map" value="map {}"/></span></div><div><span>  <pattern></span></div><div><span>    <rule context="/*/relevant/element[map:contains($some-map, @relevant-attribute)]"></span></div><div><span>      <assert test="true()">Impossible</assert></span></div><div><span>    </rule></span></div><div><span>  </pattern></span></div><div><span></schema></span></div><span></span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">When I validate the XML with the Schematron, Oxygen prints a warning that an empty sequence is not allowed as the second argument to map:contains, which I've determined is because it is testing the "element" elements under "irrelevant". I know this because if I add a second such element, the error prints twice. If I have 9, the error prints 9 times. But why is it testing that element? I deliberately used xpath that navigates via the parent because I want to include only elements under that parent, but it seems that it's looking at all elements, anywhere in the document, named 'element'. Is this expected?</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">I can silence the warning if I explicitly check for the presence of the attribute:</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span></span></div><span><?xml version="1.0" encoding="UTF-8"?></span><div><span><schema xmlns="<a href="http://purl.oclc.org/dsdl/schematron" rel="noreferrer nofollow noopener" target="_blank">http://purl.oclc.org/dsdl/schematron</a>" queryBinding="xslt3" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/1999/XSL/Transform</a>" xmlns:map="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"></span></div><div><span>  <ns prefix="map" uri="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"/></span></div><div><span>  <let name="some-map" value="map {}"/></span></div><div><span>  <pattern></span></div><div><span>    <rule context="/*/relevant/element[@relevant-attribute and map:contains($some-map, @relevant-attribute)]"></span></div><div><span>      <assert test="true()">Impossible</assert></span></div><div><span>    </rule></span></div><div><span>  </pattern></span></div><div><span></schema></span></div><div><span><br></span></div><span></span><div style="font-family: Arial, sans-serif; font-size: 14px;">But not if I precede the broken rule with a rule that should equivalently prevent the broken rule from firing on those elements:</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span></span><span><?xml version="1.0" encoding="UTF-8"?></span><div><span><schema xmlns="<a href="http://purl.oclc.org/dsdl/schematron" rel="noreferrer nofollow noopener" target="_blank">http://purl.oclc.org/dsdl/schematron</a>" queryBinding="xslt3" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/1999/XSL/Transform</a>" xmlns:map="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"></span></div><div><span>  <ns prefix="map" uri="<a href="http://www.w3.org/2005/xpath-functions/map" rel="noreferrer nofollow noopener" target="_blank">http://www.w3.org/2005/xpath-functions/map</a>"/></span></div><div><span>  <let name="some-map" value="map {}"/></span></div><div><span>  <pattern></span></div><div><span>    <rule context="/*/relevant/element[not(@relevant-attribute)]"></span></div><div><span>      <assert test="true()">Impossible</assert></span></div><div><span>    </rule></span></div><div><span>    <rule context="/*/relevant/element[map:contains($some-map, @relevant-attribute)]"></span></div><div><span>      <assert test="true()">Impossible</assert></span></div><div><span>    </rule></span></div><div><span>  </pattern></span></div><div><span></schema></span></div><span></span><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Thanks,</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">-- <br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Danny MacMillan<br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div>
<div style="font-family: Arial, sans-serif; font-size: 14px;" class="protonmail_signature_block">
    <div class="protonmail_signature_block-user protonmail_signature_block-empty"></div>

            <div class="protonmail_signature_block-proton">
        Sent with <a rel="noreferrer nofollow noopener" href="https://proton.me/" target="_blank">Proton Mail</a> secure email.
    </div>
</div>

        </blockquote><br>
    </div>