<?xml version="1.0" encoding="UTF-8"?>
<sch:pattern id="ISM-ID-00028" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
    <sch:p id="ruleText">
        [ISM-ID-00028][Error] If ISM-CAPCO-RESOURCE and attribute 
        disseminationControls contains the name token [OC], [EYES], or [RELIDO], 
        then attribute classification must have a value of [TS], [S], or [C].
    </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 we have
        an element having attribute disseminationControls with a value of 
        [OC], [EYES], or [RELIDO] then we also have the 
        attribute classification specified with a value of [C], [S], or [TS] on the 
        same element.
    </sch:p>
    <sch:rule context="//*[@ism:disseminationControls]">
        <sch:assert 
            id="ISM-00028" 
            test="
            if(not($ISM_CAPCO_RESOURCE)) then true() else                  
            count(for $token in tokenize(./@ism:disseminationControls, ' ') return     
                  if(matches($token,'^(OC|EYES|RELIDO)$') 
                     and not( matches(./@ism:classification,'^(TS|S|C)$'))) 
                         then $token                
                         else null
            )=0
            " 
            flag="error">
            [ISM-ID-00028][Error] If ISM-CAPCO-RESOURCE and attribute 
            disseminationControls contains the name token [OC], [EYES], or [RELIDO], 
            then attribute classification must have a value of [TS], [S], or [C].
        </sch:assert>
    </sch:rule>
</sch:pattern>