<?xml version="1.0" encoding="UTF-8"?>
<sch:pattern id="ISM-ID-00168" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
    <sch:p id="ruleText">
        [ISM-ID-00168][Error] If ISM-CAPCO-RESOURCE and attribute 
        disseminationControls is not specified or is specified and does not contain the name token 
        [DISPLAYONLY], then attribute displayOnlyTo 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 it is a CAPCO resource then we check that if the
        attribute displayOnlyTo is specified then the 
        attribute disseminationControls is also specified that it contains a value of 
        [DISPLAYONLY]
    </sch:p>
    <sch:rule context="//*[@ism:displayOnlyTo]">
        
        <sch:let name="dissemTok" value="tokenize(./@ism:disseminationControls,' ')"/>
        <sch:assert 
            id="ISM-00168" 
            test="
            if(not($ISM_CAPCO_RESOURCE)) then true() else
            index-of($dissemTok,'DISPLAYONLY')>0
            "
            flag="error">
            [ISM-ID-00168][Error] If ISM-CAPCO-RESOURCE and attribute 
            disseminationControls is not specified or is specified and does not contain the name token 
            [DISPLAYONLY], then attribute displayOnlyTo must not be specified.
        </sch:assert>
    </sch:rule>
</sch:pattern>