Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cmangeat committed Dec 4, 2024
1 parent 13bf13b commit bf2b88f
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
published=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gts="http://www.isotc211.org/2005/gts"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:gml320="http://www.opengis.net/gml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:tr="java:org.fao.geonet.api.records.formatters.SchemaLocalizations"
xmlns:gn-fn-render="http://geonetwork-opensource.org/xsl/functions/render"
xmlns:gn-fn-metadata="http://geonetwork-opensource.org/xsl/functions/metadata"
xmlns:gn-fn-iso19139="http://geonetwork-opensource.org/xsl/functions/profiles/iso19139"
xmlns:xslUtils="java:org.fao.geonet.util.XslUtil"
xmlns:saxon="http://saxon.sf.net/"
xmlns:che="http://www.geocat.ch/2008/che"
version="2.0"
extension-element-prefixes="saxon"
exclude-result-prefixes="#all">

<xsl:include href="../../../iso19139/formatter/citation/base.xsl"/>
<xsl:include href="../../../iso19115-3.2018/formatter/citation/common.xsl"/>

<xsl:output omit-xml-declaration="yes"
method="xml"
indent="yes"
saxon:indent-spaces="2"
encoding="UTF-8"/>

<xsl:variable name="metadata"
select="/root/che:CHE_MD_Metadata"/>

<xsl:variable name="configuration"
select="/empty"/>
<xsl:variable name="editorConfig"
select="/empty"/>

<xsl:template match="/">
<xsl:variable name="citationInfo">
<xsl:call-template name="get-iso19139-citation">
<xsl:with-param name="metadata" select="$metadata"/>
<xsl:with-param name="language" select="$language"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates mode="citation" select="$citationInfo"/>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2024 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" exclude-result-prefixes="#all">
<xsl:import href="../../iso19139/process/add-date-for-status .xsl"/>
</xsl:stylesheet>
133 changes: 24 additions & 109 deletions iso19139.che/src/main/plugin/iso19139.che/process/add-resource-id.xsl
Original file line number Diff line number Diff line change
@@ -1,113 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2024 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:geonet="http://www.fao.org/geonetwork"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gn-fn-iso19139="http://geonetwork-opensource.org/xsl/functions/profiles/iso19139"
xmlns:util="java:org.fao.geonet.util.XslUtil"
version="2.0" exclude-result-prefixes="#all">

<xsl:import href="../../iso19139/process/process-utility.xsl"/>

<!-- i18n information -->
<xsl:variable name="add-resource-id-loc">
<msg id="a" xml:lang="eng">Current record does not contain resource identifier. Add the following identifier:</msg>
<msg id="a" xml:lang="fre">Cette fiche ne contient pas d'identifiant pour la ressource. Ajouter l'identifiant
suivant :
</msg>
</xsl:variable>


<xsl:variable name="resource-id-url-prefix" select="util:getSettingValue('metadata/resourceIdentifierPrefix')"/>


<xsl:template name="list-add-resource-id">
<suggestion process="add-resource-id"/>
</xsl:template>


<!-- Analyze the metadata record and return available suggestion
for that process -->
<xsl:template name="analyze-add-resource-id">
<xsl:param name="root"/>
<xsl:variable name="hasResourceId"
select="count($root//gmd:identificationInfo/*/gmd:citation/
gmd:CI_Citation/gmd:identifier/*/gmd:code[gco:CharacterString != '']) > 0"/>

<xsl:variable name="code"
select="gn-fn-iso19139:resource-id-generate($root/*/gmd:fileIdentifier/gco:CharacterString)"/>
<xsl:if test="not($hasResourceId)">
<suggestion process="add-resource-id" id="{generate-id()}" category="identification" target="identification">
<name>
<xsl:value-of select="geonet:i18n($add-resource-id-loc, 'a', $guiLang)"/><xsl:text> </xsl:text><xsl:value-of
select="$code"/>.
</name>
<operational>true</operational>
</suggestion>
</xsl:if>

</xsl:template>


<!-- Do a copy of every nodes and attributes -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!-- Remove geonet:* elements. -->
<xsl:template match="geonet:*" priority="2"/>

<xsl:function name="gn-fn-iso19139:resource-id-generate" as="xs:string">
<xsl:param name="fileIdentifier" as="xs:string"/>

<!-- Create resource identifier based on metadata record identifier -->
<xsl:variable name="urlWithoutLang" select="substring-before($catalogUrl, $nodeId)"/>
<xsl:variable name="prefix"
select="if ($resource-id-url-prefix != '') then $resource-id-url-prefix else $urlWithoutLang"/>
<xsl:value-of select="concat($prefix, $fileIdentifier)"/>
</xsl:function>

<xsl:template
match="gmd:identificationInfo/*/gmd:citation/
gmd:CI_Citation"
priority="2">

<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of
select="gmd:title|
gmd:alternateTitle|
gmd:date|
gmd:edition|
gmd:editionDate"/>

<xsl:variable name="code"
select="gn-fn-iso19139:resource-id-generate(/*/gmd:fileIdentifier/gco:CharacterString)"/>
<xsl:copy-of
select="gmd:identifier[gmd:MD_Identifier/gmd:code/gco:CharacterString != $code]"/>
<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:value-of select="$code"/>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>

<xsl:copy-of
select="gmd:citedResponsibleParty|
gmd:presentationForm|
gmd:series|
gmd:otherCitationDetails|
gmd:collectiveTitle|
gmd:ISBN|
gmd:ISSN"/>

</xsl:copy>
</xsl:template>

<xsl:import href="../../iso19139/process/add-resource-id.xsl"/>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2024 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" exclude-result-prefixes="#all">
<xsl:import href="../../iso19139/process/collection-merge-utility.xsl"/>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2024 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" exclude-result-prefixes="#all">
<xsl:import href="../../iso19139/process/collection-updater.xsl"/>
</xsl:stylesheet>
28 changes: 28 additions & 0 deletions iso19139.che/src/main/plugin/iso19139.che/process/doi-remove.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2024 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" exclude-result-prefixes="#all">
<xsl:import href="../../iso19139/process/doi-remove.xsl"/>
</xsl:stylesheet>
42 changes: 41 additions & 1 deletion iso19139.che/src/main/plugin/iso19139.che/suggest.xsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2016 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
extension-element-prefixes="saxon"
version="2.0">


<!-- Register here the list of process for the schema-->
<xsl:include href="process/collection-updater.xsl"/>
<xsl:include href="process/keywords-comma-exploder.xsl"/>
<xsl:include href="process/scale-denominator-formatter.xsl"/>
<xsl:include href="process/add-extent-from-geokeywords.xsl"/>
Expand All @@ -14,9 +38,17 @@
<xsl:include href="process/inspire-add-conformity.xsl"/>
<xsl:include href="process/linked-data-checker.xsl"/>
<xsl:include href="process/related-metadata-checker.xsl"/>

<xsl:include href="process/add-resource-id.xsl"/>
<xsl:include href="process/add-date-for-status.xsl"/>
<!--<xsl:include href="process/vacuum.xsl"/>-->
<!-- Disabled by default because related to INSPIRE only
<xsl:include href="process/inspire-add-conformity.xsl"/>
<xsl:include href="process/inspire-add-dq-toporeport.xsl"/>
<xsl:include href="process/inspire-themes-and-topiccategory.xsl"/>
-->

<xsl:variable name="processes">
<p>collection-updater</p>
<p>keywords-comma-exploder</p>
<p>scale-denominator-formatter</p>
<p>add-extent-from-geokeywords</p>
Expand All @@ -25,6 +57,14 @@
<p>inspire-add-conformity</p>
<p>linked-data-checker</p>
<p>related-metadata-checker</p>
<p>add-resource-id</p>
<p>add-date-for-status</p>
<!--<p>vacuum</p>-->
<!-- Disabled by default because related to INSPIRE only
<p>inspire-add-conformity</p>
<p>inspire-add-dq-toporeport</p>
<p>inspire-themes-and-topiccategory</p>
-->
</xsl:variable>

<xsl:param name="action" select="'list'"/>
Expand Down

0 comments on commit bf2b88f

Please sign in to comment.