Skip to content

Commit

Permalink
validate publication date is after creation date (#352)
Browse files Browse the repository at this point in the history
* validate publication date is after creation date
  • Loading branch information
wangf1122 authored Sep 25, 2023
1 parent 5d4fc50 commit 43ee77c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<InvalidSpatialRepresentationType>Spatial representation code is not valid</InvalidSpatialRepresentationType>
<PublicationDate>Value is required for Metadata publication date</PublicationDate>
<CreationDate>Value is required for Metadata creation date</CreationDate>
<PublicationDateBeforeCreationDate>Publication Date should be after Creation Date</PublicationDateBeforeCreationDate>
<MissingDate>Value is required for Date</MissingDate>
<InvalidDateTypeCode>Date type is not valid</InvalidDateTypeCode>
<BeginDate>Value is required for Begin Date</BeginDate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<InvalidSpatialRepresentationType>Le code de fréquence de mise à jour n'est pas valide</InvalidSpatialRepresentationType>
<PublicationDate>Une valeur est nécessaire pour: Métadonnées date de publication</PublicationDate>
<CreationDate>>Une valeur est nécessaire pour: Métadonnées date de création</CreationDate>
<PublicationDateBeforeCreationDate>La date de publication doit être postérieure à la date de création</PublicationDateBeforeCreationDate>
<MissingDate>Une valeur est nécessaire pour la Date</MissingDate>
<InvalidDateTypeCode>Le code de type de date n'est pas valide</InvalidDateTypeCode>
<BeginDate>Une valeur est nécessaire pour la Date de début</BeginDate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,17 @@


<!-- Creation/revision dates -->
<sch:rule context="//gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation
|//*[@gco:isoType='gmd:MD_DataIdentification']/gmd:citation/gmd:CI_Citation
|//*[@gco:isoType='srv:SV_ServiceIdentification']/gmd:citation/gmd:CI_Citation">
<sch:rule context="//gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_367']/gmd:date
|//*[@gco:isoType='gmd:MD_DataIdentification']/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_367']/gmd:date
|//*[@gco:isoType='srv:SV_ServiceIdentification']/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_367']/gmd:date">

<sch:let name="missingPublication" value="count(gmd:date[gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_367']) = 0" />

<sch:assert
test="not($missingPublication)"
>$loc/strings/PublicationDate</sch:assert>

<sch:let name="missingCreation" value="count(gmd:date[gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_366']) = 0" />

<sch:assert
test="not($missingCreation)"
>$loc/strings/CreationDate</sch:assert>
<sch:let name="creationDate" value="../../../gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_366']/gmd:date/gco:Date[1]
|../../../gmd:date/gmd:CI_Date[gmd:dateType/gmd:CI_DateTypeCode/@codeListValue = 'RI_366']/gmd:date/gco:DateTime[1]" />
<sch:let name="missingCreation" value="not(string($creationDate))" />
<sch:let name="publicationDate" value="gco:Date|gco:DateTime" />
<sch:let name="missingPublication" value="not(string($publicationDate))" />

<sch:assert test="$missingPublication or $missingCreation or XslUtilHnap:compareDates($publicationDate, $creationDate) &gt;= 0 ">$loc/strings/PublicationDateBeforeCreationDate</sch:assert>
</sch:rule>

<sch:rule context="//gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date
Expand Down

0 comments on commit 43ee77c

Please sign in to comment.