<?xml version="1.0" encoding="UTF-8"?>
<sch:pattern id="ISM-ID-00211" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
    <sch:p id="ruleText">[ISM-ID-00211][Error] Attribute nonUSControls must not contain values that have passed their deprecation date.</sch:p>
    <sch:p id="codeDesc">Traverse the CVE file pulling out deprecated values and their dates. Using the current date determine if the values are
        being used passed the deprecated date.</sch:p>

    <sch:rule context="//*[@ism:nonUSControls]">
        <sch:let name="curDate" value="translate($ISM_RESOURCE_ELEMENT/@ism:createDate,'-','')"/>
        <sch:let name="depValues" value="document('./CVE/CVEnumISMNonUSControls.xml')//cve:CVE/cve:Enumeration/cve:Term[./@deprecated]/cve:Value"/>
        <sch:let name="depDates" value="document('./CVE/CVEnumISMNonUSControls.xml')//cve:CVE/cve:Enumeration/cve:Term/@deprecated"/>
        <sch:let name="isError" value="true()"/>
        
        <sch:let name="reportErr" value="
            dvf:deprecated(./@ism:nonUSControls, $depValues, $depDates, $curDate, $isError)
            "/>
        
        <sch:assert id="ISM-00211"
            test="count($reportErr)=0"
            flag="error">
            [ISM-ID-00211][Error] For attribute nonUSControls, value(s) <sch:value-of select="$reportErr"/>
        </sch:assert>
    </sch:rule>
</sch:pattern>