diff --git a/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl b/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl index 2b27b5e2140..dd87f5281bf 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl @@ -34,6 +34,7 @@ xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:util="java:org.fao.geonet.util.XslUtil" + xmlns:uuid="java:java.util.UUID" xmlns:gn-fn-rel="http://geonetwork-opensource.org/xsl/functions/relations" version="2.0" exclude-result-prefixes="#all"> @@ -126,8 +127,9 @@ + - + <xsl:apply-templates mode="get-iso19139-localized-string" diff --git a/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-remove.xsl b/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-remove.xsl index f11cd771f49..e945099369a 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-remove.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-remove.xsl @@ -30,6 +30,7 @@ Stylesheet used to remove a reference to a online resource. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> + <xsl:param name="resourceIndex"/> <xsl:param name="url"/> <xsl:param name="name"/> @@ -42,12 +43,12 @@ Stylesheet used to remove a reference to a online resource. <!-- Remove geonet:* elements. --> <xsl:template - match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and normalize-space(gmd:CI_OnlineResource/gmd:name/gco:CharacterString) = normalize-space($name)]" + match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and normalize-space(gmd:CI_OnlineResource/gmd:name/gco:CharacterString) = normalize-space($name)][number($resourceIndex)]" priority="2"/> <xsl:template - match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and count(gmd:CI_OnlineResource/gmd:name/gmd:PT_FreeText/gmd:textGroup[gmd:LocalisedCharacterString = $name]) > 0]" + match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and count(gmd:CI_OnlineResource/gmd:name/gmd:PT_FreeText/gmd:textGroup[gmd:LocalisedCharacterString = $name]) > 0][number($resourceIndex)]" priority="2"/> <xsl:template - match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and normalize-space(gmd:CI_OnlineResource/gmd:protocol/*) = 'WWW:DOWNLOAD-1.0-http--download']" + match="geonet:*|gmd:onLine[normalize-space(gmd:CI_OnlineResource/gmd:linkage/gmd:URL) = $url and normalize-space(gmd:CI_OnlineResource/gmd:protocol/*) = 'WWW:DOWNLOAD-1.0-http--download'][number($resourceIndex)]" priority="2"/> </xsl:stylesheet> diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js index 6d0003da1dd..faafd0e186c 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js @@ -712,7 +712,16 @@ * * @param {Object} onlinesrc the online resource to remove */ - removeOnlinesrc: function (onlinesrc) { + removeOnlinesrc: function (onlinesrc, onlines) { + //Passing the index of the xml/xpath into the remove process xsl + var xslIndex = -1; + for (var i = 0; i < onlines.length; i++) { + if (onlinesrc.id === onlines[i].id) { + xslIndex = i+1; + break; + } + } + var url = onlinesrc.lUrl || onlinesrc.url; if ( url.match(".*/api/records/' + gnCurrentEdit.uuid + '/attachments/.*") != null @@ -724,6 +733,7 @@ this, setParams("onlinesrc-remove", { id: gnCurrentEdit.id, + resourceIndex: xslIndex, url: url, name: $filter("gnLocalized")(onlinesrc.title) }) diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html index bde4ba3f9aa..b326c7a2b1b 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html @@ -219,7 +219,7 @@ aria-label="{{'remove' | translate}} {{resource.title | gnLocalized: lang}}" data-ng-if="readonly !== true" data-gn-confirm-click="{{'removeOnlinesrcConfirm' | translate:{url: resource.lUrl} }}" - data-gn-click-and-spin="onlinesrcService.removeOnlinesrc(resource)" + data-gn-click-and-spin="onlinesrcService.removeOnlinesrc(resource, relations.onlines)" > <i class="fa fa-times text-danger"></i> </a>