<?xml version="1.0" encoding="UTF-8"?>
<sch:pattern id="ISM-ID-00133" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
    <sch:p id="ruleText">
        [ISM-ID-00133][Error] If ISM-NSI-EO-APPLIES and attribute 
        declassException is specified and does contain the name token [25X1-human], 
        then attribute declassDate or declassEvent must NOT be specified.
    </sch:p>
    <sch:p id="codeDesc">
        If current Classified National Security Information Executive Order does not
        apply to this resource then the rule does not apply and we return true. 
        Otherwise we ensure that any element with the attribute declassException
        specified and having a value of [25X1-human] then we ensure that the
        attribute declassDate or attribute declassEvent are not specified.      
    </sch:p>
    <sch:rule context="//*[@ism:declassException]">
        <sch:let name="dd" value="if(./@ism:declassDate) then true() else false()"/>
        <sch:let name="de" value="if(./@ism:declassEvent) then true() else false()"/>
        <sch:assert 
            id="ISM-00133" 
            test="
            if(not($ISM_NSI_EO_APPLIES)) then true() else
            if(not(index-of(./@ism:declassException, '25X1-human')>0)) then true() else
                not($dd or $de)
            " 
            flag="error">
            [ISM-ID-00133][Error] If ISM-NSI-EO-APPLIES and attribute 
            declassException is specified and does contain the name token [25X1-human], 
            then attributes declassDate or declassEvent must NOT be specified. Invalid
            presence of <sch:value-of select="if($dd) then 'declassDate' else null"/>
            <sch:value-of select="if($dd and $de) then ' and ' else null"/>
            <sch:value-of select="if($de) then 'declassEvent' else null"/>.
        </sch:assert>
    </sch:rule>
</sch:pattern>