<?xml version="1.0" encoding="UTF-8"?>
<sch:pattern id="ISM-ID-00032" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
    <sch:p id="ruleText">
        [ISM-ID-00032][Error] If ISM-CAPCO-RESOURCE and attribute 
        disseminationControls is not specified or is specified and does not contain the name token 
        [REL] or [EYES], then attribute releasableTo must not be specified.
    </sch:p>
    <sch:p id="codeDesc">
        If CAPCO rules do not apply to the document then the rule does not apply
        and we return true. If the attribute releasableTo is specified, then we make sure
        that the attribute disseminationControls is specified with a value containing
        [EYES] or [REL].
    </sch:p>
    <sch:rule context="//*[@ism:releasableTo]">
        
        <sch:let name="dissemTok" value="tokenize(./@ism:disseminationControls,' ')"/>
        <sch:assert 
            id="ISM-00032" 
            test="
            if(not($ISM_CAPCO_RESOURCE)) then true() else
            index-of($dissemTok,'EYES')>0 or index-of($dissemTok,'REL')>0
            "
            flag="error">
            [ISM-ID-00032][Error] If ISM-CAPCO-RESOURCE and attribute 
            disseminationControls is not specified or is specified and does not contain the name token 
            [REL] or [EYES], then attribute releasableTo must not be specified.
        </sch:assert>
    </sch:rule>
</sch:pattern>