Skip to content

Commit

Permalink
MW / Suggestion / Add CC-BY #967
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Feb 6, 2025
1 parent 24d51d9 commit 1d9134c
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<span><xsl:copy-of select="translatedTitle/(text()|*)"/></span>

<xsl:value-of select="if (lastPublicationDate != '')
then concat(' (', lastPublicationDate, ')')
then concat(' (', lastPublicationDate, ') ')
else ''"/>

<!--<xsl:call-template name="citation-contact">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
xmlns:mco="http://standards.iso.org/iso/19115/-3/mco/1.0"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
xmlns:mdb="http://standards.iso.org/iso/19115/-3/mdb/2.0"
xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:util="java:org.fao.geonet.util.XslUtil"
xmlns:gn="http://www.fao.org/geonetwork"
xmlns:saxon="http://saxon.sf.net/"
extension-element-prefixes="saxon"
exclude-result-prefixes="#all">
<xsl:import href="process-utility.xsl"/>

<xsl:include href="../formatter/citation/base.xsl"/>
<xsl:include href="../formatter/citation/common.xsl"/>

<xsl:output indent="yes" method="xml"/>

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

<xsl:variable name="mw-constraints-ccby-loc">
<msg id="a" xml:lang="eng">Replace constraints by CC-BY.</msg>
<msg id="a" xml:lang="fre">Remplacer les contraintes d'accès et d'utilisation par CC-BY.</msg>
</xsl:variable>

<xsl:template name="list-mw-constraints-ccby">
<suggestion process="mw-constraints-ccby"/>
</xsl:template>

<xsl:variable name="hasCcbyConstraints"
select="count(//mri:resourceConstraints/*/mco:otherConstraints[gcx:Anchor/@xlink:href = 'https://creativecommons.org/licenses/by/4.0/']) > 0"/>

<xsl:template name="analyze-mw-constraints-ccby">
<xsl:variable name="id"
select="generate-id(.)"/>

<xsl:if test="not($hasCcbyConstraints)">
<suggestion process="mw-constraints-ccby"
id="{concat($id, '-', position())}"
category="contentinfo"
target="metadata">
<name><xsl:value-of select="gn:i18n($mw-constraints-ccby-loc, 'a', $guiLang)"/></name>
<operational>true</operational>
<params>{}</params>
</suggestion>
</xsl:if>
</xsl:template>



<xsl:variable name="metadataIdentifier"
select="//mdb:MD_Metadata/mdb:metadataIdentifier[1]/*/mcc:code/gco:CharacterString"/>

<xsl:template match="mri:resourceConstraints[not($hasCcbyConstraints)]"
priority="2">
<xsl:if test="not(preceding-sibling::mri:resourceConstraints)">
<mri:resourceConstraints>
<mco:MD_LegalConstraints>
<mco:accessConstraints>
<mco:MD_RestrictionCode
codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_RestrictionCode"
codeListValue="unrestricted"/>
</mco:accessConstraints>
<mco:otherConstraints>
<gcx:Anchor
xlink:href="http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/noLimitations">
Pas de limitation d'accès public à cette donnée.
</gcx:Anchor>
</mco:otherConstraints>
</mco:MD_LegalConstraints>
</mri:resourceConstraints>
<mri:resourceConstraints>
<mco:MD_LegalConstraints>
<mco:useConstraints>
<mco:MD_RestrictionCode
codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_RestrictionCode"
codeListValue="licenceUnrestricted"/>
</mco:useConstraints>
<mco:otherConstraints>
<gcx:Anchor xlink:href="https://creativecommons.org/licenses/by/4.0/">
Licence CC-BY 4.0 : L’utilisateur peut utiliser et modifier les données pour
en dériver une œuvre. Il peut publier les données et l’œuvre dérivée à condition de citer les sources.
</gcx:Anchor>
</mco:otherConstraints>
<mco:otherConstraints>
<xsl:variable name="citationInfo">
<xsl:call-template name="get-iso19115-3.2018-citation">
<xsl:with-param name="metadata" select="ancestor::mdb:MD_Metadata"/>
<xsl:with-param name="language" select="'fre'"/>
</xsl:call-template>
</xsl:variable>

<xsl:variable name="citationAsHtml">
<xsl:apply-templates mode="citation" select="$citationInfo"/>
</xsl:variable>

<gco:CharacterString>
Source : <xsl:value-of select="normalize-space($citationAsHtml)"/>
</gco:CharacterString>
</mco:otherConstraints>
</mco:MD_LegalConstraints>
</mri:resourceConstraints>
</xsl:if>
</xsl:template>

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

<!-- Copy everything. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<xsl:include href="process/add-date-for-status.xsl"/>
<xsl:include href="process/add-online-resource-from-atom.xsl"/>
<xsl:include href="process/add-connectpoint-from-esrirest.xsl"/>
<xsl:include href="process/mw-constraints-ccby.xsl"/>
<!--<xsl:include href="process/inspire-add-conformity.xsl"/>-->

<xsl:variable name="processes">
Expand All @@ -37,6 +38,7 @@
<p>add-date-for-status</p>
<p>spatineo-registration</p>
<p>add-online-resource-from-atom</p>
<p>mw-constraints-ccby</p>
<!--<p>inspire-add-conformity</p>-->
</xsl:variable>

Expand Down

0 comments on commit 1d9134c

Please sign in to comment.