Skip to content

Commit

Permalink
Modified tpl-csv.xsl to support csv output comliant with ONDC
Browse files Browse the repository at this point in the history
  • Loading branch information
ByronCinNZ authored and ByronCinNZ committed Sep 12, 2024
1 parent 4873f76 commit 0c0e0c5
Show file tree
Hide file tree
Showing 13 changed files with 41,280 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
<tab id="descriptiveKeywordsIcsm">
<section name="mri:descriptiveKeywords">
<field xpath="/mdb:MD_Metadata/mdb:identificationInfo/*/mri:descriptiveKeywords"
or="descriptiveKeywords" in="/mdb:MD_Metadata/mdb:identificationInfo/*" del="."/>
or="descriptiveKeywords" in="/mdb:MD_Metadata/mdb:identificationInfo/*" del=".."/>
</section>
</tab>
<tab id="spatialInfoIcsm" mode="flat" displayIfRecord="count(mdb:MD_Metadata/mdb:metadataScope/mdb:MD_MetadataScope/mdb:resourceScope[*/@codeListValue ='attributeType']) = 0 ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,37 @@
</xsl:apply-templates>
</abstract>

<xsl:for-each select="mdb:identificationInfo/*/mri:citation/*/cit:identifier/*/mcc:code/*[. != '']">
<Point_of_Contact>
<xsl:value-of select="mdb:contact/cit:CI_Responsibility/cit:party/*/cit:contactInfo/*/cit:address/*/cit:electronicMailAddress"/>
</Point_of_Contact>

<xsl:variable name="classification" select="mdb:identificationInfo/*/mri:resourceConstraints/mco:MD_SecurityConstraints/mco:useLimitation/*"/>
<Access_Rights>
<xsl:choose>
<xsl:when test="$classification=('PROTECTED', 'SECRET', 'TOP SECRET')">Restricted</xsl:when>
<xsl:when test="$classification=('OFFICIAL', 'OFFICIAL: Sensitive')">Conditional</xsl:when>
<xsl:otherwise>Open</xsl:otherwise>
</xsl:choose>
</Access_Rights>
<Security_Constraints>
<xsl:value-of select="$classification"/>
</Security_Constraints>

<xsl:for-each select="mdb:identificationInfo/*/mri:pointOfContact/*[cit:role/cit:CI_RoleCode/codeListValue='pointOfContact']">
<Data_Custodian>
<xsl:value-of select="mdb:identificationInfo/*/mri:pointOfContact/*/cit:party/*/cit:name"/>
</Data_Custodian>
</xsl:for-each>

<xsl:for-each select="mdb:identificationInfo/*/mri:descriptiveKeywords/*/mri:keyword[not(@gco:nilReason)]">
<Keyword>
<xsl:apply-templates mode="localised" select=".">
<xsl:with-param name="langId" select="$langId"/>
</xsl:apply-templates>
</Keyword>
</xsl:for-each>

<!-- <xsl:for-each select="mdb:identificationInfo/*/mri:citation/*/cit:identifier/*/mcc:code/*[. != '']">
<resourceIdentifier>
<xsl:value-of select="."/>
</resourceIdentifier>
Expand Down Expand Up @@ -110,23 +140,72 @@
</xsl:for-each>

<xsl:for-each select="mdb:identificationInfo/*//gex:EX_GeographicBoundingBox">
<geoBox>
<westBL>
<xsl:value-of select="gex:westBoundLongitude"/>
</westBL>
<eastBL>
<GeoBox>
<SouthBL>
<xsl:value-of select="concat(gex:southBoundLatitude, ', ')"/>
</SouthBL>
<WestBL>
<xsl:value-of select="concat(gex:westBoundLongitude, ', ')"/>
</WestBL>
<NorthBL>
<xsl:value-of select="concat(gex:northBoundLatitude, ', ')"/>
</NorthBL>
<EastBL>
<xsl:value-of select="gex:eastBoundLongitude"/>
</eastBL>
<southBL>
<xsl:value-of select="gex:southBoundLatitude"/>
</southBL>
<northBL>
<xsl:value-of select="gex:northBoundLatitude"/>
</northBL>
</geoBox>
</EastBL>
</GeoBox>
</xsl:for-each>

<xsl:for-each select="mdb:identificationInfo/*//gex:EX_TemporalExtent/gex:extent">
<Temporal_coverage_from>
<xsl:value-of select="*/*[1]"/>
</Temporal_coverage_from>

<Temporal_coverage_to>
<xsl:value-of select="*/*[2]"/>
</Temporal_coverage_to>
</xsl:for-each>

<Update_Frequency>
<xsl:value-of select="mdb:identificationInfo/*/mri:resourceMaintenance/mmi:MD_MaintenanceInformation/mmi:maintenanceAndUpdateFrequency/mmi:MD_MaintenanceFrequencyCode/@codeListValue"/>
</Update_Frequency>

<Purpose>
<xsl:value-of select="mdb:identificationInfo/*/mri:purpose"/>
</Purpose>

<xsl:for-each select="mdb:identificationInfo/*/mri:descriptiveKeywords/*[mri:type/mri:MD_KeywordTypeCode/@codeListValue='place']">
<Location>
<xsl:value-of select="mri:keyword"/>
</Location>
</xsl:for-each>

<xsl:for-each select="mdb:identificationInfo/*/*/mco:MD_Constraints/*">
<Access_URL>
<xsl:value-of select="mdb:metadataLinkage/cit:CI_OnlineResource/cit:linkage/*"/>
</Access_URL>

<License>
<xsl:value-of select="mdb:identificationInfo/*/mri:resourceConstraints/mco:MD_LegalConstraints/mco:reference/*/cit:onlineResource/*/cit:linkage/*"/>
</License>

<Sensitive_Data>

</Sensitive_Data>

<Legal_Authority>

</Legal_Authority>

<Disposal>
<xsl:for-each select="mdb:identificationInfo/*/mri:resourceConstraints/mco:MD_Constraints/mco:useLimitation/*">
<xsl:if test="starts-with(., 'Disposal')">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>

</Disposal>

<!--<xsl:for-each select="mdb:identificationInfo/*/*/mco:MD_Constraints/*">
<Constraints>
<xsl:copy-of select="."/>
</Constraints>
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/main/resources/catalog/locales/en-search.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"exportcheXML": "Export (XML)",
"exportGM03": "Export (GM03)",
"exportRDF": "Export (RDF)",
"exportCSV": "Export (CSV)",
"exportCSV": "Export (ONDC)",
"exportPDF": "Export (PDF)",
"exportMEF": "Export (ZIP)",
"welcomeText": "Here you will find data, services and maps and more.",
Expand Down
Loading

0 comments on commit 0c0e0c5

Please sign in to comment.