[Mapbender-commits] r9552 - trunk/mapbender/http/geoportal/xslt

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 8 06:50:35 PDT 2016


Author: armin11
Date: 2016-08-08 06:50:35 -0700 (Mon, 08 Aug 2016)
New Revision: 9552

Modified:
   trunk/mapbender/http/geoportal/xslt/iso-19139-to-dcat-ap.xsl
Log:
New version of the xslt to transform iso19139 records to rdf (GeoDCAT)

Modified: trunk/mapbender/http/geoportal/xslt/iso-19139-to-dcat-ap.xsl
===================================================================
--- trunk/mapbender/http/geoportal/xslt/iso-19139-to-dcat-ap.xsl	2016-07-22 10:30:23 UTC (rev 9551)
+++ trunk/mapbender/http/geoportal/xslt/iso-19139-to-dcat-ap.xsl	2016-08-08 13:50:35 UTC (rev 9552)
@@ -1,90 +1,75 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
 
-<!--  
-
-  Copyright 2015 EUROPEAN UNION
+  Copyright 2015-2016 EUROPEAN UNION
   Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
   the European Commission - subsequent versions of the EUPL (the "Licence");
   You may not use this work except in compliance with the Licence.
   You may obtain a copy of the Licence at:
- 
+
   http://ec.europa.eu/idabc/eupl
- 
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the Licence is distributed on an "AS IS" basis,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the Licence for the specific language governing permissions and
   limitations under the Licence.
- 
-  Authors: European Commission - Joint Research Centre
-           Andrea Perego <andrea.perego at jrc.ec.europa.eu>
- 
+
+  Authors:      European Commission - Joint Research Centre
+                Andrea Perego <andrea.perego at jrc.ec.europa.eu>
+
+  Contributors: ISA GeoDCAT-AP Working Group
+                <dcat_application_profile-geo at joinup.ec.europa.eu>
+
   This work was supported by the EU Interoperability Solutions for
   European Public Administrations Programme (http://ec.europa.eu/isa)
-  through Action 1.17: Re-usable INSPIRE Reference Platform 
+  through Action 1.17: Re-usable INSPIRE Reference Platform
   (http://ec.europa.eu/isa/actions/01-trusted-information-exchange/1-17action_en.htm).
 
 -->
-
 <!--
 
   PURPOSE AND USAGE
 
   This XSLT is a proof of concept for the implementation of the specification
-  concerning the geospatial profile of DCAT-AP (GeoDCAT-AP), available on 
+  concerning the geospatial profile of DCAT-AP (GeoDCAT-AP), available on
   Joinup, the collaboration platform of the EU ISA Programme:
-  
+
     https://joinup.ec.europa.eu/node/139283/
-    
-  As such, this XSLT must be considered as unstable, and can be updated any 
-  time based on the revisions to the GeoDCAT-AP specifications and 
+
+  As such, this XSLT must be considered as unstable, and can be updated any
+  time based on the revisions to the GeoDCAT-AP specifications and
   related work in the framework of INSPIRE and the EU ISA Programme.
-  
+
 -->
+<xsl:transform xmlns:adms="http://www.w3.org/ns/adms#" xmlns:cnt="http://www.w3.org/2011/content#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:dct="http://purl.org/dc/terms/" xmlns:dctype="http://purl.org/dc/dcmitype/" xmlns:earl="http://www.w3.org/ns/earl#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gsp="http://www.opengis.net/ont/geosparql#" xmlns:i="http://inspire.ec.europa.eu/schemas/common/1.0" xmlns:i-gp="http://inspire.ec.europa.eu/schemas/geoportal/1.0" xmlns:locn="http://www.w3.org/ns/locn#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:org="http://www.w3.org/ns/org#" xmlns:prov="http://www.w3.org/ns/prov#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:
 skos="http://www.w3.org/2004/02/skos/core#" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xmlns:wdrs="http://www.w3.org/2007/05/powder-s#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="earl gco gmd gml gmx i i-gp srv xlink xsi xsl wdrs" version="1.0">
 
-<xsl:transform
-    xmlns:xsl    = "http://www.w3.org/1999/XSL/Transform"
-    xmlns:rdf    = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:rdfs   = "http://www.w3.org/2000/01/rdf-schema#"
-    xmlns:owl    = "http://www.w3.org/2002/07/owl#"
-    xmlns:skos   = "http://www.w3.org/2004/02/skos/core#"
-    xmlns:cnt    = "http://www.w3.org/2011/content#"
-    xmlns:dc     = "http://purl.org/dc/elements/1.1/" 
-    xmlns:dct    = "http://purl.org/dc/terms/"
-    xmlns:dctype = "http://purl.org/dc/dcmitype/"
-    xmlns:earl   = "http://www.w3.org/ns/earl#"
-    xmlns:dcat   = "http://www.w3.org/ns/dcat#"
-    xmlns:foaf   = "http://xmlns.com/foaf/0.1/"
-    xmlns:wdrs   = "http://www.w3.org/2007/05/powder-s#"
-    xmlns:prov   = "http://www.w3.org/ns/prov#"
-    xmlns:vcard  = "http://www.w3.org/2006/vcard/ns#"
-    xmlns:adms   = "http://www.w3.org/ns/adms#"
-    xmlns:gsp    = "http://www.opengis.net/ont/geosparql#"
-    xmlns:locn   = "http://www.w3.org/ns/locn#"
-    xmlns:gmd    = "http://www.isotc211.org/2005/gmd" 
-    xmlns:gmx    = "http://www.isotc211.org/2005/gmx" 
-    xmlns:gco    = "http://www.isotc211.org/2005/gco" 
-    xmlns:srv    = "http://www.isotc211.org/2005/srv"
-    xmlns:xsi    = "http://www.w3.org/2001/XMLSchema-instance" 
-    xmlns:gml    = "http://www.opengis.net/gml" 
-    xmlns:xlink  = "http://www.w3.org/1999/xlink" 
-    xmlns:ns9    = "http://inspire.ec.europa.eu/schemas/geoportal/1.0"
-    xmlns:i      = "http://inspire.ec.europa.eu/schemas/common/1.0"
-    xmlns:schema = "http://schema.org/"
-    version="1.0">
+  <xsl:output method="xml" indent="yes" encoding="utf-8" cdata-section-elements="locn:geometry"/>
 
-  <xsl:output method="xml"
-              indent="yes"
-              encoding="utf-8"
-              cdata-section-elements="locn:geometry" />
+<!--
 
+  Global variables
+  ================
+
+-->
+
+<!-- Variables $core and $extended. -->
 <!--
 
+  These variables are meant to be placeholders for the IDs used for the core and extended profiles of GeoDCAT-AP.
+
+-->
+
+  <xsl:variable name="core">core</xsl:variable>
+  <xsl:variable name="extended">extended</xsl:variable>
+
+<!--
+
   Mapping parameters
   ==================
-  
-  This section includes mapping parameters to be modified manually. 
 
+  This section includes mapping parameters by the XSLT processor used, or, possibly, manually.
+
 -->
 
 <!-- Parameter $profile -->
@@ -93,7 +78,7 @@
   This parameter specifies the GeoDCAT-AP profile to be used:
   - value "core": the GeoDCAT-AP Core profile, which includes only the INSPIRE and ISO 19115 core metadata elements supported in DCAT-AP
   - value "extended": the GeoDCAT-AP Extended profile, which defines mappings for all the INSPIRE and ISO 19115 core metadata elements
-  
+
   The current specifications for the core and extended GeoDCAT-AP profiles are available on the Joinup collaboration platform:
 
     https://joinup.ec.europa.eu/node/139283/
@@ -102,42 +87,69 @@
 
 <!-- Uncomment to use GeoDCAT-AP Core -->
 <!--
-  <xsl:param name="profile">core</xsl:param>
+  <xsl:param name="profile" select="$core"/>
 -->
 <!-- Uncomment to use GeoDCAT-AP Extended -->
-  <xsl:param name="profile">extended</xsl:param>
+  <xsl:param name="profile" select="$extended"/>
 
+
+<!-- Parameter $CoupledResourceLookUp -->
 <!--
 
+  This parameter specifies whether the coupled resource, referenced via @xlink:href, should be looked up to fetch the resource's  unique resource identifier (i.e., code and code space). More precisely:
+  - value "enabled": The coupled resource is looked up
+  - value "disabled": The coupled resource is not looked up
+
+  The default value is "enabled" for GeoDCAT-AP Extended, and "disabled" otherwise.
+
+  CAVEAT: Using this feature may cause the transformation to hang, in case the URL in @xlink:href is broken, the request hangs indefinitely, or does not return the expected resource (e.g., and HTML page, instead of an XML-encoded ISO 19139 record). It is strongly recommended that this issue is dealt with by using appropriate configuration parameters and error handling (e.g., by specifying a timeout on HTTP calls and by setting the HTTP Accept header to "application/xml").
+
+-->
+
+  <xsl:param name="CoupledResourceLookUp">
+    <xsl:choose>
+      <xsl:when test="$profile = $extended">
+        <xsl:text>enabled</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>disabled</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:param>
+
+<!--
+
   Other global parameters
   =======================
-  
--->  
 
+-->
+
 <!-- Variables to be used to convert strings into lower/uppercase by using the translate() function. -->
 
   <xsl:variable name="lowercase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
   <xsl:variable name="uppercase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
 
-<!-- URIs and URNs for spatial reference system registers. -->
-  
-  <xsl:param name="EpsgSrsBaseUri">http://www.opengis.net/def/crs/EPSG/0/</xsl:param>
+<!-- URIs, URNs and names for spatial reference system registers. -->
+
+  <xsl:param name="EpsgSrsBaseUri">http://www.opengis.net/def/crs/EPSG/0</xsl:param>
   <xsl:param name="EpsgSrsBaseUrn">urn:ogc:def:crs:EPSG</xsl:param>
-  <xsl:param name="OgcSrsBaseUri">http://www.opengis.net/def/crs/OGC/</xsl:param>
+  <xsl:param name="EpsgSrsName">EPSG Coordinate Reference Systems</xsl:param>
+  <xsl:param name="OgcSrsBaseUri">http://www.opengis.net/def/crs/OGC</xsl:param>
   <xsl:param name="OgcSrsBaseUrn">urn:ogc:def:crs:OGC</xsl:param>
-  
+  <xsl:param name="OgcSrsName">OGC Coordinate Reference Systems</xsl:param>
+
 <!-- URI and URN for CRS84. -->
 
-  <xsl:param name="Crs84Uri" select="concat($OgcSrsBaseUri,'1.3/CRS84')"/>
+  <xsl:param name="Crs84Uri" select="concat($OgcSrsBaseUri,'/1.3/CRS84')"/>
   <xsl:param name="Crs84Urn" select="concat($OgcSrsBaseUrn,':1.3:CRS84')"/>
 
 <!-- URI and URN for ETRS89. -->
 
-  <xsl:param name="Etrs89Uri" select="concat($EpsgSrsBaseUri,'4258')"/>
+  <xsl:param name="Etrs89Uri" select="concat($EpsgSrsBaseUri,'/4258')"/>
   <xsl:param name="Etrs89Urn" select="concat($EpsgSrsBaseUrn,'::4258')"/>
 
 <!-- URI and URN of the spatial reference system (SRS) used in the bounding box.
-     The default SRS is CRS84. If a different SRS is used, also parameter 
+     The default SRS is CRS84. If a different SRS is used, also parameter
      $SrsAxisOrder must be specified. -->
 
 <!-- The SRS URI is used in the WKT and GML encodings of the bounding box. -->
@@ -145,12 +157,12 @@
 <!-- The SRS URN is used in the GeoJSON encoding of the bounding box. -->
   <xsl:param name="SrsUrn" select="$Crs84Urn"/>
 
-<!-- Axis order for the reference SRS: 
+<!-- Axis order for the reference SRS:
      - "LonLat": longitude / latitude
      - "LatLon": latitude / longitude.
-     The axis order must be specified only if the reference SRS is different from CRS84. 
-     If the reference SRS is CRS84, this parameter is ignored. -->  
-  
+     The axis order must be specified only if the reference SRS is different from CRS84.
+     If the reference SRS is CRS84, this parameter is ignored. -->
+
   <xsl:param name="SrsAxisOrder">LonLat</xsl:param>
 
 <!-- Namespaces -->
@@ -162,16 +174,18 @@
   <xsl:param name="timeUri">http://placetime.com/</xsl:param>
   <xsl:param name="timeInstantUri" select="concat($timeUri,'instant/gregorian/')"/>
   <xsl:param name="timeIntervalUri" select="concat($timeUri,'interval/gregorian/')"/>
--->  
+-->
   <xsl:param name="dcat">http://www.w3.org/ns/dcat#</xsl:param>
   <xsl:param name="gsp">http://www.opengis.net/ont/geosparql#</xsl:param>
-<!-- Old params used for the SRS 
+  <xsl:param name="foaf">http://xmlns.com/foaf/0.1/</xsl:param>
+  <xsl:param name="vcard">http://www.w3.org/2006/vcard/ns#</xsl:param>
+<!-- Old params used for the SRS
   <xsl:param name="ogcCrsBaseUri">http://www.opengis.net/def/EPSG/0/</xsl:param>
   <xsl:param name="ogcCrsBaseUrn">urn:ogc:def:EPSG::</xsl:param>
--->  
+-->
 <!-- Currently not used.
   <xsl:param name="inspire">http://inspire.ec.europa.eu/schemas/md/</xsl:param>
--->  
+-->
 <!-- Currently not used.
   <xsl:param name="kos">http://ec.europa.eu/open-data/kos/</xsl:param>
   <xsl:param name="kosil" select="concat($kos,'interoperability-level/')"/>
@@ -179,7 +193,7 @@
   <xsl:param name="kosdss" select="concat($kos,'dataset-status/Completed')"/>
   <xsl:param name="kosdoct" select="concat($kos,'documentation-type/')"/>
   <xsl:param name="koslic" select="concat($kos,'licence/EuropeanCommission')"/>
--->  
+-->
   <xsl:param name="op">http://publications.europa.eu/resource/authority/</xsl:param>
   <xsl:param name="opcountry" select="concat($op,'country/')"/>
   <xsl:param name="oplang" select="concat($op,'language/')"/>
@@ -189,8 +203,8 @@
 <!-- This is used as the datatype for the GeoJSON-based encoding of the bounding box. -->
   <xsl:param name="geojsonMediaTypeUri">https://www.iana.org/assignments/media-types/application/vnd.geo+json</xsl:param>
 
-<!-- INSPIRE code list URIs -->  
-  
+<!-- INSPIRE code list URIs -->
+
   <xsl:param name="INSPIRECodelistUri">http://inspire.ec.europa.eu/metadata-codelist/</xsl:param>
   <xsl:param name="SpatialDataServiceCategoryCodelistUri" select="concat($INSPIRECodelistUri,'SpatialDataServiceCategory')"/>
   <xsl:param name="DegreeOfConformityCodelistUri" select="concat($INSPIRECodelistUri,'DegreeOfConformity')"/>
@@ -199,51 +213,51 @@
   <xsl:param name="SpatialDataServiceTypeCodelistUri" select="concat($INSPIRECodelistUri,'SpatialDataServiceType')"/>
   <xsl:param name="TopicCategoryCodelistUri" select="concat($INSPIRECodelistUri,'TopicCategory')"/>
 
-<!-- INSPIRE code list URIs (not yet supported; the URI pattern is tentative) -->  
-  
+<!-- INSPIRE code list URIs (not yet supported; the URI pattern is tentative) -->
+
   <xsl:param name="SpatialRepresentationTypeCodelistUri" select="concat($INSPIRECodelistUri,'SpatialRepresentationTypeCode')"/>
   <xsl:param name="MaintenanceFrequencyCodelistUri" select="concat($INSPIRECodelistUri,'MaintenanceFrequencyCode')"/>
 
-<!-- INSPIRE glossary URI -->  
-  
+<!-- INSPIRE glossary URI -->
+
   <xsl:param name="INSPIREGlossaryUri">http://inspire.ec.europa.eu/glossary/</xsl:param>
 
-<!-- 
+<!--
 
-  Master template     
+  Master template
   ===============
- 
+
  -->
- 
+
   <xsl:template match="/">
     <rdf:RDF>
       <xsl:apply-templates select="gmd:MD_Metadata|//gmd:MD_Metadata"/>
     </rdf:RDF>
   </xsl:template>
 
-<!-- 
+<!--
 
-  Metadata template     
+  Metadata template
   =================
- 
+
  -->
-  
+
   <xsl:template match="gmd:MD_Metadata|//gmd:MD_Metadata">
 
-<!-- 
+<!--
 
-  Parameters to create HTTP URIs for the resource and the corresponding metadata record 
+  Parameters to create HTTP URIs for the resource and the corresponding metadata record
   =====================================================================================
 
   These parameters must be customised depending on the strategy used to assign HTTP URIs.
-  
+
   The default rule implies that HTTP URIs are specified for the metadata file identifier
   (metadata URI) and the resource identifier (resource URI).
 
--->  
+-->
 
   <xsl:param name="ResourceUri">
-    <xsl:variable name="rURI" select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco:CharacterString"/>
+    <xsl:variable name="rURI" select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/*/gmd:code/gco:CharacterString"/>
     <xsl:if test="$rURI != '' and ( starts-with($rURI, 'http://') or starts-with($rURI, 'https://') )">
       <xsl:value-of select="$rURI"/>
     </xsl:if>
@@ -256,19 +270,29 @@
     </xsl:if>
   </xsl:param>
 
-<!-- 
+<!--
 
-  Other parameters 
+  Other parameters
   ================
-  
--->  
-  
+
+-->
+
 <!-- Metadata language: corresponding Alpha-2 codes -->
-  
+
     <xsl:param name="ormlang">
-      <xsl:value-of select="gmd:language/gmd:LanguageCode/@codeListValue"/>
+      <xsl:choose>
+        <xsl:when test="gmd:language/gmd:LanguageCode/@codeListValue != ''">
+          <xsl:value-of select="translate(gmd:language/gmd:LanguageCode/@codeListValue,$uppercase,$lowercase)"/>
+        </xsl:when>
+        <xsl:when test="gmd:language/gmd:LanguageCode != ''">
+          <xsl:value-of select="translate(gmd:language/gmd:LanguageCode,$uppercase,$lowercase)"/>
+        </xsl:when>
+        <xsl:when test="gmd:language/gco:CharacterString != ''">
+          <xsl:value-of select="translate(gmd:language/gco:CharacterString,$uppercase,$lowercase)"/>
+        </xsl:when>
+      </xsl:choose>
     </xsl:param>
-    
+
     <xsl:param name="MetadataLanguage">
       <xsl:choose>
         <xsl:when test="$ormlang = 'bul'">
@@ -280,7 +304,7 @@
         <xsl:when test="$ormlang = 'dan'">
           <xsl:text>da</xsl:text>
         </xsl:when>
-        <xsl:when test="$ormlang = 'ger'">  
+        <xsl:when test="$ormlang = 'ger'">
           <xsl:text>de</xsl:text>
         </xsl:when>
         <xsl:when test="$ormlang = 'gre'">
@@ -352,8 +376,19 @@
 <!-- Resource language: corresponding Alpha-2 codes -->
 
     <xsl:param name="orrlang">
-      <xsl:value-of select="gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue"/>
+      <xsl:choose>
+        <xsl:when test="gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue != ''">
+          <xsl:value-of select="translate(gmd:identificationInfo/*/gmd:language/gmd:LanguageCode/@codeListValue,$uppercase,$lowercase)"/>
+        </xsl:when>
+        <xsl:when test="gmd:identificationInfo/*/gmd:language/gmd:LanguageCode != ''">
+          <xsl:value-of select="translate(gmd:identificationInfo/*/gmd:language/gmd:LanguageCode,$uppercase,$lowercase)"/>
+        </xsl:when>
+        <xsl:when test="gmd:identificationInfo/*/gmd:language/gco:CharacterString != ''">
+          <xsl:value-of select="translate(gmd:identificationInfo/*/gmd:language/gco:CharacterString,$uppercase,$lowercase)"/>
+        </xsl:when>
+      </xsl:choose>
     </xsl:param>
+
     <xsl:param name="ResourceLanguage">
       <xsl:choose>
         <xsl:when test="$orrlang = 'bul'">
@@ -365,7 +400,7 @@
         <xsl:when test="$orrlang = 'dan'">
           <xsl:text>da</xsl:text>
         </xsl:when>
-        <xsl:when test="$orrlang = 'ger'">  
+        <xsl:when test="$orrlang = 'ger'">
           <xsl:text>de</xsl:text>
         </xsl:when>
         <xsl:when test="$orrlang = 'gre'">
@@ -437,11 +472,11 @@
     <xsl:param name="ResourceType">
       <xsl:value-of select="gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue"/>
     </xsl:param>
-    
+
     <xsl:param name="ServiceType">
       <xsl:value-of select="gmd:identificationInfo/*/srv:serviceType/gco:LocalName"/>
     </xsl:param>
-    
+
     <xsl:param name="ResourceTitle">
       <xsl:value-of select="gmd:identificationInfo[1]/*/gmd:citation/*/gmd:title/gco:CharacterString"/>
     </xsl:param>
@@ -466,13 +501,13 @@
     </xsl:param>
 
     <xsl:param name="UniqueResourceIdentifier">
-      <xsl:for-each select="gmd:identificationInfo[1]/*/gmd:citation/*/gmd:identifier/gmd:RS_Identifier">
+      <xsl:for-each select="gmd:identificationInfo[1]/*/gmd:citation/*/gmd:identifier/*">
         <xsl:choose>
           <xsl:when test="gmd:codeSpace/gco:CharacterString/text() != ''">
-            <xsl:value-of select="concat(translate(gmd:codeSpace/gco:CharacterString/text(),' ','%20'),translate(gmd:code/gco:CharacterString/text(),' ','%20'))"/>
+            <xsl:value-of select="concat(gmd:codeSpace/gco:CharacterString/text(),gmd:code/gco:CharacterString/text())"/>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:value-of select="translate(gmd:code/gco:CharacterString/text(),' ','%20')"/>
+            <xsl:value-of select="gmd:code/gco:CharacterString/text()"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each>
@@ -483,9 +518,9 @@
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
       </xsl:apply-templates>
     </xsl:param>
-    
-<!-- Conformity, expressed by using an earl:Assertion (only for the extended profile) -->    
-<!--    
+
+<!-- Conformity, expressed by using an earl:Assertion (only for the extended profile) -->
+<!--
     <xsl:param name="Conformity">
       <xsl:for-each select="gmd:dataQualityInfo/*/gmd:report/*/gmd:result/*/gmd:specification/gmd:CI_Citation">
         <xsl:variable name="specinfo">
@@ -540,8 +575,8 @@
       </xsl:for-each>
     </xsl:param>
 -->
-<!-- Conformity, expressed by using a prov:Activity (only for the extended profile) -->    
-    
+<!-- Conformity, expressed by using a prov:Activity (only for the extended profile) -->
+
     <xsl:param name="Conformity">
       <xsl:for-each select="gmd:dataQualityInfo/*/gmd:report/*/gmd:result/*/gmd:specification/gmd:CI_Citation">
         <xsl:variable name="specinfo">
@@ -559,13 +594,13 @@
               <xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notConformant')"/>
             </xsl:when>
             <xsl:otherwise>
-<!--        
+<!--
             <xsl:when test="../../gmd:pass/gco:Boolean = ''">
--->        
+-->
               <xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notEvaluated')"/>
-<!--          
+<!--
             </xsl:when>
--->        
+-->
             </xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
@@ -582,13 +617,13 @@
               <xsl:choose>
                 <xsl:when test="../@xlink:href and ../@xlink:href != ''">
                   <prov:wasDerivedFrom rdf:resource="{../@xlink:href}"/>
-<!--                  
+<!--
                   <prov:wasDerivedFrom>
                     <rdf:Description rdf:about="{../@xlink:href}">
                       <xsl:copy-of select="$specinfo"/>
                     </rdf:Description>
                   </prov:wasDerivedFrom>
--->                  
+-->
                 </xsl:when>
                 <xsl:otherwise>
                   <prov:wasDerivedFrom rdf:parseType="Resource">
@@ -620,7 +655,7 @@
     </xsl:param>
 
 <!-- Metadata character encoding (only for the extended profile) -->
-    
+
     <xsl:param name="MetadataCharacterEncoding">
       <xsl:apply-templates select="gmd:characterSet/gmd:MD_CharacterSetCode"/>
     </xsl:param>
@@ -628,11 +663,11 @@
     <xsl:param name="ResourceCharacterEncoding">
       <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification">
         <xsl:apply-templates select="gmd:characterSet/gmd:MD_CharacterSetCode"/>
-      </xsl:for-each>  
+      </xsl:for-each>
     </xsl:param>
 
-<!-- Metadata description (metadata on metadata) -->    
-    
+<!-- Metadata description (metadata on metadata) -->
+
     <xsl:param name="MetadataDescription">
 <!-- Metadata language -->
       <xsl:if test="$ormlang != ''">
@@ -645,19 +680,27 @@
         </dct:modified>
       </xsl:if>
 <!-- Metadata point of contact: only for the extended profile -->
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
+        <xsl:for-each select="gmd:contact">
+          <xsl:apply-templates select="gmd:CI_ResponsibleParty">
+            <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
+            <xsl:with-param name="ResourceType" select="$ResourceType"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+<!-- Old version      
         <xsl:apply-templates select="gmd:contact/gmd:CI_ResponsibleParty">
           <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
         </xsl:apply-templates>
+-->        
       </xsl:if>
 <!-- Metadata file identifier (tentative): only for the extended profile -->
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <xsl:for-each select="gmd:fileIdentifier/gco:CharacterString">
           <dct:identifier rdf:datatype="{$xsd}string"><xsl:value-of select="."/></dct:identifier>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:if>
 <!-- Metadata standard (tentative): only for the extended profile -->
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <xsl:variable name="MetadataStandardURI" select="gmd:metadataStandardName/gmx:Anchor/@xlink:href"/>
         <xsl:variable name="MetadataStandardName" select="gmd:metadataStandardName/*[self::gco:CharacterString|self::gmx:Anchor]"/>
         <xsl:variable name="MetadataStandardVersion" select="gmd:metadataStandardVersion/gco:CharacterString"/>
@@ -669,18 +712,18 @@
             </xsl:if>
             <xsl:choose>
               <xsl:when test="$MetadataStandardURI != ''">
-<!-- Metadata standard, denoted by a URI -->              
+<!-- Metadata standard, denoted by a URI -->
                 <dct:conformsTo rdf:resource="{$MetadataStandardURI}"/>
               </xsl:when>
               <xsl:when test="$MetadataStandardName != ''">
                 <dct:conformsTo rdf:parseType="Resource">
-<!-- Metadata standard name -->              
+<!-- Metadata standard name -->
                   <dct:title xml:lang="{$MetadataLanguage}"><xsl:value-of select="$MetadataStandardName"/></dct:title>
                   <xsl:if test="$MetadataStandardVersion != ''">
-<!-- Metadata standard version -->              
+<!-- Metadata standard version -->
                     <owl:versionInfo xml:lang="{$MetadataLanguage}"><xsl:value-of select="$MetadataStandardVersion"/></owl:versionInfo>
                   </xsl:if>
-                </dct:conformsTo>    
+                </dct:conformsTo>
               </xsl:when>
             </xsl:choose>
           </dct:source>
@@ -702,16 +745,16 @@
 
                   <owl:versionInfo xml:lang="{$MetadataLanguage}"><xsl:value-of select="../../gmd:metadataStandardVersion/gco:CharacterString"/></owl:versionInfo>
                 </xsl:if>
-              </dct:conformsTo>    
+              </dct:conformsTo>
             </dct:source>
           </xsl:if>
         </xsl:for-each>
--->        
+-->
       </xsl:if>
-    </xsl:param>  
-    
-<!-- Resource description (resource metadata) -->    
+    </xsl:param>
 
+<!-- Resource description (resource metadata) -->
+
     <xsl:param name="ResourceDescription">
       <xsl:choose>
         <xsl:when test="$ResourceType = 'dataset'">
@@ -721,7 +764,7 @@
           <rdf:type rdf:resource="{$dcat}Dataset"/>
         </xsl:when>
         <xsl:when test="$ResourceType = 'service'">
-          <xsl:if test="$profile = 'extended'">
+          <xsl:if test="$profile = $extended">
             <rdf:type rdf:resource="{$dctype}Service"/>
           </xsl:if>
           <xsl:if test="$ServiceType = 'discovery'">
@@ -729,7 +772,7 @@
           </xsl:if>
         </xsl:when>
       </xsl:choose>
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <dct:type rdf:resource="{$ResourceTypeCodelistUri}/{$ResourceType}"/>
       </xsl:if>
       <dct:title xml:lang="{$MetadataLanguage}"><xsl:value-of select="$ResourceTitle"/></dct:title>
@@ -738,10 +781,10 @@
       </dct:description>
 <!-- Maintenance information (tentative) -->
       <xsl:for-each select="gmd:identificationInfo/*/gmd:resourceMaintenance">
-        <xsl:apply-templates select="gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode"/>      
+        <xsl:apply-templates select="gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode"/>
       </xsl:for-each>
 <!-- Topic category -->
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <xsl:apply-templates select="gmd:identificationInfo/*/gmd:topicCategory">
           <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
         </xsl:apply-templates>
@@ -753,26 +796,26 @@
         <xsl:with-param name="ServiceType" select="$ServiceType"/>
       </xsl:apply-templates>
 <!-- Identifier, 0..1 -->
-<!--        
-      <xsl:apply-templates select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier">
+<!--
+      <xsl:apply-templates select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/*">
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
       </xsl:apply-templates>
--->        
+-->
 <!-- Resource locators -->
 <!--
       <xsl:apply-templates select="gmd:distributionInfo/*/gmd:transferOptions/*/gmd:onLine/*/gmd:linkage">
         <xsl:with-param name="ResourceType" select="$ResourceType"/>
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
       </xsl:apply-templates>
--->      
+-->
 <!-- Unique Resource Identifier -->
-      <xsl:apply-templates select="gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/gmd:RS_Identifier"/>
+      <xsl:apply-templates select="gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*"/>
 <!-- Coupled resources -->
       <xsl:apply-templates select="gmd:identificationInfo[1]/*/srv:operatesOn">
         <xsl:with-param name="ResourceType" select="$ResourceType"/>
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
       </xsl:apply-templates>
-<!-- Resource Language -->        
+<!-- Resource Language -->
       <xsl:if test="$ResourceType = 'dataset' or $ResourceType = 'series'">
         <xsl:choose>
           <xsl:when test="$orrlang != ''">
@@ -780,28 +823,28 @@
           </xsl:when>
           <xsl:otherwise>
 <!-- To be decided (when the resource language is not specified, it defaults to the metadata language): -->
-<!-- 
+<!--
              <xsl:if test="$ormlang != ''">
                <dct:language rdf:resource="{concat($oplang,translate($ormlang,$lowercase,$uppercase))}"/>
              </xsl:if>
--->            
+-->
           </xsl:otherwise>
         </xsl:choose>
       </xsl:if>
 <!-- Spatial service type -->
-      <xsl:if test="$ResourceType = 'service' and $profile = 'extended'">
+      <xsl:if test="$ResourceType = 'service' and $profile = $extended">
 <!-- Replaced by param $ServiceType -->
-<!--      
+<!--
         <xsl:apply-templates select="gmd:identificationInfo/*/srv:serviceType">
           <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
         </xsl:apply-templates>
--->        
+-->
         <dct:type rdf:resource="{$SpatialDataServiceTypeCodelistUri}/{$ServiceType}"/>
       </xsl:if>
 <!-- Spatial extent -->
 <!--
       <xsl:apply-templates select="gmd:identificationInfo[1]/*/*[self::gmd:extent|self::srv:extent]/*/gmd:geographicElement/gmd:EX_GeographicBoundingBox"/>
--->      
+-->
       <xsl:apply-templates select="gmd:identificationInfo[1]/*/*[self::gmd:extent|self::srv:extent]/*/gmd:geographicElement">
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
       </xsl:apply-templates>
@@ -819,12 +862,14 @@
           </dct:ProvenanceStatement>
         </dct:provenance>
       </xsl:if>
-<!-- Coordinate and temporal reference systems (tentative) -->      
-      <xsl:apply-templates select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier">
-        <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
-      </xsl:apply-templates>
+<!-- Coordinate and temporal reference systems (tentative) -->
+      <xsl:if test="$profile = $extended">
+        <xsl:apply-templates select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier">
+          <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
+        </xsl:apply-templates>
+      </xsl:if>
 <!-- Spatial resolution -->
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <xsl:apply-templates select="gmd:identificationInfo/*/gmd:spatialResolution/gmd:MD_Resolution"/>
       </xsl:if>
 <!-- Conformity -->
@@ -834,21 +879,21 @@
         <xsl:with-param name="Conformity" select="$Conformity"/>
       </xsl:apply-templates>
       <xsl:choose>
-        <xsl:when test="$ResourceType = 'service' and ($ServiceType = 'discovery' or $profile = 'extended')">
+        <xsl:when test="$ResourceType = 'service' and ($ServiceType = 'discovery' or $profile = $extended)">
           <xsl:copy-of select="$ConstraintsRelatedToAccessAndUse"/>
         </xsl:when>
 <!-- Distributions -->
         <xsl:when test="$ResourceType = 'dataset' or $ResourceType = 'series'">
-<!-- Spatial representation type -->        
+<!-- Spatial representation type -->
           <xsl:variable name="SpatialRepresentationType">
             <xsl:apply-templates select="gmd:identificationInfo/*/gmd:spatialRepresentationType/gmd:MD_SpatialRepresentationTypeCode"/>
           </xsl:variable>
           <xsl:for-each select="gmd:distributionInfo/gmd:MD_Distribution">
-<!-- Encoding --> 
-            <xsl:variable name="Encoding">     
+<!-- Encoding -->
+            <xsl:variable name="Encoding">
                <xsl:apply-templates select="gmd:distributionFormat/gmd:MD_Format/gmd:name/*"/>
-            </xsl:variable>             
-<!-- Resource locators (access / download URLs) -->          
+            </xsl:variable>
+<!-- Resource locators (access / download URLs) -->
             <xsl:for-each select="gmd:transferOptions/*/gmd:onLine/*">
               <xsl:variable name="function" select="gmd:function/gmd:CI_OnLineFunctionCode/@codeListValue"/>
               <xsl:variable name="TitleAndDescription">
@@ -860,12 +905,12 @@
                 </xsl:for-each>
               </xsl:variable>
               <xsl:choose>
-                <xsl:when test="$function = 'download'or $function = 'offlineAccess' or $function = 'order'"> 
+                <xsl:when test="$function = 'download' or $function = 'offlineAccess' or $function = 'order'">
                   <dcat:distribution>
                     <dcat:Distribution>
 <!-- Title and description -->
                       <xsl:copy-of select="$TitleAndDescription"/>
-<!-- Access URL -->                      
+<!-- Access URL -->
                       <xsl:for-each select="gmd:linkage/gmd:URL">
                         <dcat:accessURL rdf:resource="{.}"/>
                       </xsl:for-each>
@@ -876,14 +921,14 @@
 <!-- Encoding -->
                       <xsl:copy-of select="$Encoding"/>
 <!-- Resource character encoding -->
-                      <xsl:if test="$profile = 'extended'">
+                      <xsl:if test="$profile = $extended">
                         <xsl:copy-of select="$ResourceCharacterEncoding"/>
                       </xsl:if>
                     </dcat:Distribution>
                   </dcat:distribution>
                 </xsl:when>
                 <xsl:when test="$function = 'information' or $function = 'search'">
-<!-- ?? Should foaf:page be detailed with title, description, etc.? -->                
+<!-- ?? Should foaf:page be detailed with title, description, etc.? -->
                   <xsl:for-each select="gmd:linkage/gmd:URL">
                     <foaf:page>
                       <foaf:Document rdf:about="{.}">
@@ -892,7 +937,7 @@
                     </foaf:page>
                   </xsl:for-each>
                 </xsl:when>
-<!-- ?? Should dcat:landingPage be detailed with title, description, etc.? -->                
+<!-- ?? Should dcat:landingPage be detailed with title, description, etc.? -->
                 <xsl:otherwise>
                   <xsl:for-each select="gmd:linkage/gmd:URL">
                     <dcat:landingPage>
@@ -904,21 +949,29 @@
                 </xsl:otherwise>
               </xsl:choose>
             </xsl:for-each>
-          </xsl:for-each>    
+          </xsl:for-each>
         </xsl:when>
-      </xsl:choose>               
+      </xsl:choose>
 <!-- Responsible organisation -->
+      <xsl:for-each select="gmd:identificationInfo/*/gmd:pointOfContact">
+        <xsl:apply-templates select="gmd:CI_ResponsibleParty">
+          <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
+          <xsl:with-param name="ResourceType" select="$ResourceType"/>
+        </xsl:apply-templates>
+      </xsl:for-each>
+<!--      
       <xsl:apply-templates select="gmd:identificationInfo/*/gmd:pointOfContact/gmd:CI_ResponsibleParty">
         <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
         <xsl:with-param name="ResourceType" select="$ResourceType"/>
       </xsl:apply-templates>
+-->      
     </xsl:param>
 
     <xsl:choose>
       <xsl:when test="$ResourceUri != ''">
-<!--      
-        <xsl:if test="$profile = 'extended'"> 
--->        
+<!--
+        <xsl:if test="$profile = $extended">
+-->
           <xsl:choose>
             <xsl:when test="$MetadataUri != ''">
               <rdf:Description rdf:about="{$MetadataUri}">
@@ -937,9 +990,9 @@
               </xsl:if>
             </xsl:otherwise>
           </xsl:choose>
-<!--          
+<!--
         </xsl:if>
--->        
+-->
         <rdf:Description rdf:about="{$ResourceUri}">
           <xsl:copy-of select="$ResourceDescription"/>
         </rdf:Description>
@@ -958,24 +1011,24 @@
         </rdf:Description>
       </xsl:otherwise>
     </xsl:choose>
-    
-    <xsl:if test="$profile = 'extended' and $ResourceUri != '' and $Conformity != ''">
+
+    <xsl:if test="$profile = $extended and $ResourceUri != '' and $Conformity != ''">
       <xsl:copy-of select="$Conformity"/>
     </xsl:if>
-    
-      
+
+
   </xsl:template>
-  
+
 <!--
 
   Templates for specific metadata elements
   ========================================
 
--->  
-  
-<!-- Unique Resource Identifier -->  
-  
-  <xsl:template name="UniqueResourceIdentifier" match="gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/gmd:RS_Identifier">
+-->
+
+<!-- Unique Resource Identifier -->
+
+  <xsl:template name="UniqueResourceIdentifier" match="gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*">
     <xsl:param name="ns">
       <xsl:value-of select="gmd:codeSpace/gco:CharacterString"/>
     </xsl:param>
@@ -987,15 +1040,15 @@
         <xsl:when test="$ns != ''">
           <xsl:choose>
             <xsl:when test="substring($ns,string-length($ns),1) = '/'">
-          <xsl:value-of select="concat(translate($ns,' ','%20'),translate($code,' ','%20'))"/>
+          <xsl:value-of select="concat($ns,$code)"/>
             </xsl:when>
             <xsl:otherwise>
-          <xsl:value-of select="concat(translate($ns,' ','%20'),'/',translate($code,' ','%20'))"/>
+          <xsl:value-of select="concat($ns,'/',$code)"/>
             </xsl:otherwise>
           </xsl:choose>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:value-of select="translate($code,' ','%20')"/>
+          <xsl:value-of select="$code"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:param>
@@ -1012,9 +1065,11 @@
     <dct:identifier rdf:datatype="{$idDatatypeURI}"><xsl:value-of select="$id"/></dct:identifier>
   </xsl:template>
 
-<!-- Responsible Organisation -->      
-
+<!-- Responsible Organisation -->
+<!--
   <xsl:template name="ResponsibleOrganisation" match="gmd:identificationInfo/*/gmd:pointOfContact/gmd:CI_ResponsibleParty">
+-->  
+  <xsl:template name="ResponsibleOrganisation" match="gmd:CI_ResponsibleParty">
     <xsl:param name="MetadataLanguage"/>
     <xsl:param name="ResourceType"/>
     <xsl:param name="role">
@@ -1024,57 +1079,267 @@
     <xsl:param name="ResponsiblePartyRole">
       <xsl:value-of select="concat($ResponsiblePartyRoleCodelistUri,'/',$role)"/>
     </xsl:param>
+    <xsl:param name="IndividualURI">
+      <xsl:value-of select="normalize-space(gmd:individualName/*/@xlink:href)"/>
+    </xsl:param>
+    <xsl:param name="IndividualName">
+      <xsl:value-of select="normalize-space(gmd:individualName/*)"/>
+    </xsl:param>
+    <xsl:param name="OrganisationURI">
+      <xsl:value-of select="normalize-space(gmd:organisationName/*/@xlink:href)"/>
+    </xsl:param>
+    <xsl:param name="URI">
+      <xsl:choose>
+        <xsl:when test="$IndividualURI != ''">
+          <xsl:value-of select="$IndividualURI"/>
+        </xsl:when>
+        <xsl:when test="$OrganisationURI != ''">
+          <xsl:value-of select="$OrganisationURI"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:param>
     <xsl:param name="OrganisationName">
-      <xsl:value-of select="gmd:organisationName/gco:CharacterString"/>
+      <xsl:value-of select="normalize-space(gmd:organisationName/*)"/>
     </xsl:param>
+    <xsl:param name="Email">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/*">
+        <foaf:mbox rdf:resource="mailto:{normalize-space(.)}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="Email-vCard">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/*">
+        <vcard:hasEmail rdf:resource="mailto:{normalize-space(.)}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="URL">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
+        <foaf:workplaceHomepage rdf:resource="{normalize-space(.)}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="URL-vCard">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
+        <vcard:hasURL rdf:resource="{normalize-space(.)}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="Telephone">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice/*">
+        <foaf:phone rdf:resource="tel:+{translate(translate(translate(translate(translate(normalize-space(.),' ',''),'(',''),')',''),'+',''),'.','')}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="Telephone-vCard">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice/*">
+        <vcard:hasTelephone rdf:resource="tel:+{translate(translate(translate(translate(translate(normalize-space(.),' ',''),'(',''),')',''),'+',''),'.','')}"/>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="Address">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address">
+        <xsl:variable name="deliveryPoint" select="normalize-space(gmd:deliveryPoint/*)"/>
+        <xsl:variable name="city" select="normalize-space(gmd:city/*)"/>
+        <xsl:variable name="administrativeArea" select="normalize-space(gmd:administrativeArea/*)"/>
+        <xsl:variable name="postalCode" select="normalize-space(gmd:postalCode/*)"/>
+        <xsl:variable name="country" select="normalize-space(gmd:country/*)"/>
+        <locn:address>
+          <locn:Address>
+            <xsl:if test="$deliveryPoint != ''">
+              <locn:thoroughfare><xsl:value-of select="$deliveryPoint"/></locn:thoroughfare>
+            </xsl:if>
+            <xsl:if test="$city != ''">
+              <locn:postName><xsl:value-of select="$city"/></locn:postName>
+            </xsl:if>
+            <xsl:if test="$administrativeArea != ''">
+              <locn:adminUnitL2><xsl:value-of select="$administrativeArea"/></locn:adminUnitL2>
+            </xsl:if>
+            <xsl:if test="$postalCode != ''">
+              <locn:postCode><xsl:value-of select="$postalCode"/></locn:postCode>
+            </xsl:if>
+            <xsl:if test="$country != ''">
+              <locn:adminUnitL1><xsl:value-of select="$country"/></locn:adminUnitL1>
+            </xsl:if>
+          </locn:Address>
+        </locn:address>
+      </xsl:for-each>
+    </xsl:param>
+    <xsl:param name="Address-vCard">
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address">
+        <xsl:variable name="deliveryPoint" select="normalize-space(gmd:deliveryPoint/*)"/>
+        <xsl:variable name="city" select="normalize-space(gmd:city/*)"/>
+        <xsl:variable name="administrativeArea" select="normalize-space(gmd:administrativeArea/*)"/>
+        <xsl:variable name="postalCode" select="normalize-space(gmd:postalCode/*)"/>
+        <xsl:variable name="country" select="normalize-space(gmd:country/*)"/>
+        <vcard:hasAddress>
+          <vcard:Address>
+            <xsl:if test="$deliveryPoint != ''">
+              <vcard:street-address><xsl:value-of select="$deliveryPoint"/></vcard:street-address>
+            </xsl:if>
+            <xsl:if test="$city != ''">
+              <vcard:locality><xsl:value-of select="$city"/></vcard:locality>
+            </xsl:if>
+            <xsl:if test="$administrativeArea != ''">
+              <vcard:region><xsl:value-of select="$administrativeArea"/></vcard:region>
+            </xsl:if>
+            <xsl:if test="$postalCode != ''">
+              <vcard:postal-code><xsl:value-of select="$postalCode"/></vcard:postal-code>
+            </xsl:if>
+            <xsl:if test="$country != ''">
+              <vcard:country-name><xsl:value-of select="$country"/></vcard:country-name>
+            </xsl:if>
+          </vcard:Address>
+        </vcard:hasAddress>
+      </xsl:for-each>
+    </xsl:param>
     <xsl:param name="ROInfo">
-      <foaf:Organization>
-        <foaf:name xml:lang="{$MetadataLanguage}">
-          <xsl:value-of select="$OrganisationName"/>
-        </foaf:name>
-        <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString">
-          <foaf:mbox rdf:resource="mailto:{.}"/>
-        </xsl:for-each>
-        <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
-<!-- ?? Should another property be used instead? E.g., foaf:homepage? -->        
-          <foaf:workplaceHomepage rdf:resource="{.}"/>
-        </xsl:for-each>
-      </foaf:Organization>
+      <xsl:variable name="info">
+        <xsl:choose>
+          <xsl:when test="$IndividualName != ''">
+            <rdf:type rdf:resource="{$foaf}Person"/>
+          </xsl:when>
+          <xsl:when test="$OrganisationName != ''">
+            <rdf:type rdf:resource="{$foaf}Organization"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <rdf:type rdf:resource="{$foaf}Agent"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$IndividualName != ''">
+          <foaf:name xml:lang="{$MetadataLanguage}">
+            <xsl:value-of select="$IndividualName"/>
+          </foaf:name>
+          <xsl:if test="$OrganisationName != ''">
+            <org:memberOf>
+              <xsl:choose>
+                <xsl:when test="$OrganisationURI != ''">
+                  <foaf:Organization rdf:about="{$OrganisationURI}">
+                    <foaf:name xml:lang="{$MetadataLanguage}"><xsl:value-of select="$OrganisationName"/></foaf:name>
+                  </foaf:Organization>
+                </xsl:when>
+                <xsl:otherwise>
+                  <foaf:Organization>
+                    <foaf:name xml:lang="{$MetadataLanguage}"><xsl:value-of select="$OrganisationName"/></foaf:name>
+                  </foaf:Organization>
+                </xsl:otherwise>
+              </xsl:choose>
+            </org:memberOf>
+          </xsl:if>
+        </xsl:if>
+        <xsl:if test="$IndividualName != '' and $OrganisationName != ''">
+          <foaf:name xml:lang="{$MetadataLanguage}">
+            <xsl:value-of select="$OrganisationName"/>
+          </foaf:name>
+        </xsl:if>
+        <xsl:copy-of select="$Telephone"/>
+        <xsl:copy-of select="$Email"/>
+        <xsl:copy-of select="$URL"/>
+        <xsl:copy-of select="$Address"/>
+<!--        
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString">
+        <foaf:mbox rdf:resource="mailto:{.}"/>
+      </xsl:for-each>
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
+-->        
+<!-- ?? Should another property be used instead? E.g., foaf:homepage? -->
+<!--
+        <foaf:workplaceHomepage rdf:resource="{.}"/>
+      </xsl:for-each>
+-->        
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$IndividualURI != ''">
+          <rdf:Description rdf:resource="{$IndividualURI}">
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:when>
+        <xsl:when test="$OrganisationURI != ''">
+          <rdf:Description rdf:resource="{$OrganisationURI}">
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:when>
+        <xsl:otherwise>
+          <rdf:Description>
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:param>
     <xsl:param name="ResponsibleParty">
-      <vcard:Kind>
-        <vcard:organization-name xml:lang="{$MetadataLanguage}">
-          <xsl:value-of select="$OrganisationName"/>
-        </vcard:organization-name>
-        <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString">
-          <vcard:hasEmail rdf:resource="mailto:{.}"/>
-        </xsl:for-each>
-        <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
-          <vcard:hasURL rdf:resource="{.}"/>
-        </xsl:for-each>
-      </vcard:Kind>
+      <xsl:variable name="info">
+        <xsl:choose>
+          <xsl:when test="$IndividualName != ''">
+            <rdf:type rdf:resource="{$vcard}Individual"/>
+          </xsl:when>
+          <xsl:when test="$OrganisationName != ''">
+            <rdf:type rdf:resource="{$vcard}Organization"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <rdf:type rdf:resource="{$vcard}Kind"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$IndividualName != ''">
+          <vcard:fn xml:lang="{$MetadataLanguage}">
+            <xsl:value-of select="$OrganisationName"/>
+          </vcard:fn>
+        </xsl:if>
+        <xsl:if test="$IndividualName != '' and $OrganisationName != ''">
+          <vcard:organization-name xml:lang="{$MetadataLanguage}">
+            <xsl:value-of select="$OrganisationName"/>
+          </vcard:organization-name>
+        </xsl:if>
+        <xsl:if test="$IndividualName = '' and $OrganisationName != ''">
+          <vcard:fn xml:lang="{$MetadataLanguage}">
+            <xsl:value-of select="$OrganisationName"/>
+          </vcard:fn>
+        </xsl:if>
+        <xsl:copy-of select="$Telephone-vCard"/>
+        <xsl:copy-of select="$Email-vCard"/>
+        <xsl:copy-of select="$URL-vCard"/>
+        <xsl:copy-of select="$Address-vCard"/>
+<!--        
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString">
+        <vcard:hasEmail rdf:resource="mailto:{.}"/>
+      </xsl:for-each>
+      <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
+        <vcard:hasURL rdf:resource="{.}"/>
+      </xsl:for-each>
+-->        
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$IndividualURI != ''">
+          <rdf:Description rdf:resource="{$IndividualURI}">
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:when>
+        <xsl:when test="$OrganisationURI != ''">
+          <rdf:Description rdf:resource="{$OrganisationURI}">
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:when>
+        <xsl:otherwise>
+          <rdf:Description>
+            <xsl:copy-of select="$info"/>
+          </rdf:Description>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:param>
     <xsl:choose>
-<!--   
+<!--
       <xsl:when test="$role = 'resourceProvider'">
         <schema:provider>
           <xsl:copy-of select="$ROInfo"/>
         </schema:provider>
       </xsl:when>
--->      
-<!--      
+-->
+<!--
       <xsl:when test="$role = 'custodian'">
         <rdarole:custodian>
           <xsl:copy-of select="$ROInfo"/>
         </rdarole:custodian>
       </xsl:when>
--->      
-      <xsl:when test="$role = 'owner' and $profile = 'extended'">
+-->
+      <xsl:when test="$role = 'owner' and $profile = $extended">
         <dct:rightsHolder>
           <xsl:copy-of select="$ROInfo"/>
         </dct:rightsHolder>
       </xsl:when>
-<!--      
+<!--
       <xsl:when test="$role = 'user'">
         <prov:wasUsedBy>
           <prov:Activity>
@@ -1085,31 +1350,33 @@
         </prov:wasUsedBy>
       </xsl:when>
 -->
-<!--        
+<!--
       <xsl:when test="$role = 'distributor'">
         <rdarole:distributor>
           <xsl:copy-of select="$ROInfo"/>
         </rdarole:distributor>
       </xsl:when>
--->        
-      <xsl:when test="$role = 'originator' and $ResourceType != 'service'">
+-->
+<!--
+      <xsl:when test="$role = 'originator' and $profile = $extended">
         <dct:creator>
           <xsl:copy-of select="$ROInfo"/>
         </dct:creator>
       </xsl:when>
+-->
       <xsl:when test="$role = 'pointOfContact' and $ResourceType != 'service'">
         <dcat:contactPoint>
           <xsl:copy-of select="$ResponsibleParty"/>
         </dcat:contactPoint>
       </xsl:when>
-<!--      
+<!--
       <xsl:when test="$role = 'principalInvestigator'">
         <dct:contributor>
           <xsl:copy-of select="$ROInfo"/>
         </dct:contributor>
       </xsl:when>
--->      
-<!--      
+-->
+<!--
       <xsl:when test="$role = 'processor'">
         <prov:entityOfInfluence>
           <prov:Derivation>
@@ -1123,21 +1390,19 @@
           </prov:Derivation>
         </prov:entityOfInfluence>
       </xsl:when>
--->      
+-->
       <xsl:when test="$role = 'publisher'">
         <dct:publisher>
           <xsl:copy-of select="$ROInfo"/>
         </dct:publisher>
       </xsl:when>
-<!--      
-      <xsl:when test="$role = 'author'">
-        <rdarole:author>
+      <xsl:when test="$role = 'author' and $profile = $extended">
+        <dct:creator>
           <xsl:copy-of select="$ROInfo"/>
-        </rdarole:author>
+        </dct:creator>
       </xsl:when>
--->        
     </xsl:choose>
-    <xsl:if test="$profile = 'extended'">
+    <xsl:if test="$profile = $extended">
       <prov:qualifiedAttribution>
         <prov:Attribution>
           <prov:agent>
@@ -1150,7 +1415,7 @@
   </xsl:template>
 
 <!-- Metadata point of contact -->
-
+<!--
   <xsl:template name="MetadataPointOfContact" match="gmd:contact/gmd:CI_ResponsibleParty">
     <xsl:param name="MetadataLanguage"/>
     <xsl:param name="ResponsiblePartyRole">
@@ -1168,11 +1433,11 @@
           <vcard:hasEmail rdf:resource="mailto:{.}"/>
         </xsl:for-each>
       </vcard:Kind>
-    </xsl:param>    
+    </xsl:param>
     <dcat:contactPoint>
       <xsl:copy-of select="$ResponsibleParty"/>
     </dcat:contactPoint>
-    <xsl:if test="$profile = 'extended'">
+    <xsl:if test="$profile = $extended">
       <prov:qualifiedAttribution>
         <prov:Attribution>
           <prov:agent>
@@ -1180,10 +1445,10 @@
           </prov:agent>
           <dct:type rdf:resource="{$ResponsiblePartyRole}"/>
         </prov:Attribution>
-      </prov:qualifiedAttribution>    
+      </prov:qualifiedAttribution>
     </xsl:if>
   </xsl:template>
-
+-->
 <!-- Resource locator -->
 <!-- Old version, applied to the resource (not to the resource distribution)
   <xsl:template name="ResourceLocator" match="gmd:distributionInfo/*/gmd:transferOptions/*/gmd:onLine/*/gmd:linkage">
@@ -1206,42 +1471,83 @@
         <dct:title xml:lang="{$MetadataLanguage}"><xsl:value-of select="../gmd:description/gco:CharacterString"/></dct:title>
         <dcat:accessURL rdf:resource="{gmd:URL}"/>
      </xsl:when>
-<!--      
+<!--
       <xsl:when test="$ResourceType = 'service'">
         <foaf:homepage rdf:resource="{gmd:URL}"/>
       </xsl:when>
--->      
+-->
     </xsl:choose>
   </xsl:template>
 
 <!-- Coupled resource -->
 
   <xsl:template name="CoupledResource" match="gmd:identificationInfo[1]/*/srv:operatesOn">
-<!--  
-    <dcat:dataset rdf:resource="{@xlink:href}"/>
--->    
+    <xsl:param name="href" select="@xlink:href"/>
+    <xsl:param name="code">
+      <xsl:choose>
+        <xsl:when test="$CoupledResourceLookUp = 'enabled' and $href != '' and (starts-with($href, 'http://') or starts-with($href, 'https://'))">
+          <xsl:value-of select="document($href)//gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*/gmd:code/gco:CharacterString"/>
+        </xsl:when>
+        <xsl:when test="*/gmd:citation/*/gmd:identifier/*/gmd:code/gco:CharacterString != ''">
+          <xsl:value-of select="*/gmd:citation/*/gmd:identifier/*/gmd:code/gco:CharacterString"/>
+        </xsl:when>
+        <xsl:when test="@uuidref != ''">
+          <xsl:value-of select="@uuidref"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:param>
+    <xsl:param name="codespace">
+      <xsl:choose>
+        <xsl:when test="$CoupledResourceLookUp = 'enabled' and $href != '' and (starts-with($href, 'http://') or starts-with($href, 'https://'))">
+          <xsl:value-of select="document($href)//gmd:identificationInfo/*/gmd:citation/*/gmd:identifier/*/gmd:codeSpace/gco:CharacterString"/>
+        </xsl:when>
+        <xsl:when test="*/gmd:citation/*/gmd:identifier/*/gmd:codeSpace/gco:CharacterString != ''">
+          <xsl:value-of select="*/gmd:citation/*/gmd:identifier/*/gmd:codeSpace/gco:CharacterString"/>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:param>
+    <xsl:param name="resID" select="concat($codespace, $code)"/>
+    <xsl:param name="uriref" select="@uriref"/>
     <xsl:choose>
-      <xsl:when test="@uriref">
+<!-- The use of @uriref is still under discussion by the INSPIRE MIG. -->
+      <xsl:when test="$uriref != ''">
         <dct:hasPart rdf:resource="{@uriref}"/>
       </xsl:when>
-      <xsl:when test="@xlink:href">
-        <dct:hasPart rdf:parseType="Resource">
-          <foaf:isPrimaryTopicOf>
-            <dcat:CatalogRecord rdf:about="{@xlink:href}"/>
-          </foaf:isPrimaryTopicOf>
-        </dct:hasPart>
+      <xsl:when test="$code != ''">
+        <xsl:choose>
+          <xsl:when test="starts-with($code, 'http://') or starts-with($code, 'https://')">
+            <dct:hasPart rdf:resource="{$code}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <dct:hasPart rdf:parseType="Resource">
+              <xsl:choose>
+                <xsl:when test="starts-with($resID, 'http://') or starts-with($resID, 'https://')">
+                  <dct:identifier rdf:datatype="{$xsd}anyURI"><xsl:value-of select="$resID"/></dct:identifier>
+                </xsl:when>
+                <xsl:otherwise>
+                  <dct:identifier rdf:datatype="{$xsd}string"><xsl:value-of select="$resID"/></dct:identifier>
+                </xsl:otherwise>
+              </xsl:choose>
+              <xsl:if test="$href != '' and $href != '' and (starts-with($href, 'http://') or starts-with($href, 'https://'))">
+                <foaf:isPrimaryTopicOf>
+                  <dcat:CatalogRecord rdf:about="{$href}"/>
+                </foaf:isPrimaryTopicOf>
+              </xsl:if>
+            </dct:hasPart>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:when>
     </xsl:choose>
   </xsl:template>
-  
-<!-- Spatial data service type -->  
+
+<!-- Spatial data service type -->
 <!-- Replaced by param $ServiceType -->
-<!--  
+<!--
   <xsl:template match="gmd:identificationInfo/*/srv:serviceType">
     <dct:type rdf:resource="{$SpatialDataServiceTypeCodelistUri}/{gco:LocalName}"/>
   </xsl:template>
--->  
-<!-- Conformity -->  
+-->
+<!-- Conformity -->
   <xsl:template name="Conformity" match="gmd:dataQualityInfo/*/gmd:report/*/gmd:result/*/gmd:specification/gmd:CI_Citation">
     <xsl:param name="ResourceUri"/>
     <xsl:param name="MetadataLanguage"/>
@@ -1252,7 +1558,7 @@
       </dct:title>
       <xsl:apply-templates select="gmd:date/gmd:CI_Date"/>
     </xsl:variable>
-<!--    
+<!--
     <xsl:variable name="degree">
       <xsl:choose>
         <xsl:when test="../../gmd:pass/gco:Boolean = 'true'">
@@ -1262,28 +1568,28 @@
           <xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notConformant')"/>
         </xsl:when>
         <xsl:otherwise>
-        
+
         <xsl:when test="../../gmd:pass/gco:Boolean = ''">
-       
+
           <xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notEvaluated')"/>
-          
+
         </xsl:when>
-       
+
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
--->    
+-->
     <xsl:if test="../../gmd:pass/gco:Boolean = 'true'">
       <xsl:choose>
         <xsl:when test="../@xlink:href and ../@xlink:href != ''">
           <dct:conformsTo rdf:resource="{../@xlink:href}"/>
-<!--          
+<!--
           <dct:conformsTo>
             <rdf:Description rdf:about="{../@xlink:href}">
               <xsl:copy-of select="$specinfo"/>
             </rdf:Description>
           </dct:conformsTo>
--->          
+-->
         </xsl:when>
         <xsl:otherwise>
           <dct:conformsTo rdf:parseType="Resource">
@@ -1292,11 +1598,11 @@
         </xsl:otherwise>
       </xsl:choose>
     </xsl:if>
-    <xsl:if test="$profile = 'extended'">
+    <xsl:if test="$profile = $extended">
       <xsl:if test="$Conformity != '' and $ResourceUri = ''">
         <xsl:copy-of select="$Conformity"/>
       </xsl:if>
-<!--    
+<!--
       <xsl:choose>
         <xsl:when test="../@xlink:href and ../@xlink:href != ''">
           <wdrs:describedby>
@@ -1329,15 +1635,15 @@
           </wdrs:describedby>
         </xsl:otherwise>
       </xsl:choose>
--->    
+-->
     </xsl:if>
   </xsl:template>
-  
-<!-- Geographic extent -->  
 
+<!-- Geographic extent -->
+
   <xsl:template name="GeographicExtent" match="gmd:identificationInfo[1]/*/*[self::gmd:extent|self::srv:extent]/*/gmd:geographicElement">
     <xsl:param name="MetadataLanguage"/>
-<!--      
+<!--
 
       <xsl:otherwise>
         <dct:spatial>
@@ -1345,24 +1651,24 @@
             <xsl:for-each select="gmd:description">
               <rdfs:label xml:lang="{$MetadataLanguage}"><xsl:value-of select="gco:CharacterString"/></rdfs:label>
             </xsl:for-each>
--->        
+-->
             <xsl:apply-templates select="gmd:EX_GeographicDescription/gmd:geographicIdentifier/*">
               <xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
             </xsl:apply-templates>
             <xsl:apply-templates select="gmd:EX_GeographicBoundingBox"/>
-<!--            
+<!--
           </dct:Location>
         </dct:spatial>
       </xsl:otherwise>
     </xsl:choose>
--->    
+-->
   </xsl:template>
 
-<!-- Geographic identifier -->  
+<!-- Geographic identifier -->
 
   <xsl:template name="GeographicIdentifier" match="gmd:EX_GeographicDescription/gmd:geographicIdentifier/*">
     <xsl:param name="MetadataLanguage"/>
-<!--    
+<!--
     <xsl:param name="GeoCode" select="gmd:code/*[self::gco:CharacterString|self::gmx:Anchor/@xlink:href]"/>
     <xsl:param name="GeoURI" select="gmd:code/gmx:Anchor/@xlink:href"/>
 -->
@@ -1386,10 +1692,10 @@
         <xsl:value-of select="$GeoCode"/>
       </xsl:if>
     </xsl:param>
-    
+
     <xsl:choose>
       <xsl:when test="$GeoURI != ''">
-<!--      
+<!--
         <xsl:choose>
           <xsl:when test="gmd:EX_GeographicBoundingBox">
             <dct:spatial>
@@ -1402,18 +1708,18 @@
             </dct:spatial>
           </xsl:when>
           <xsl:otherwise>
--->          
+-->
             <dct:spatial rdf:resource="{$GeoURI}"/>
-<!--            
+<!--
           </xsl:otherwise>
         </xsl:choose>
--->        
+-->
       </xsl:when>
       <xsl:when test="$GeoCode != ''">
         <dct:spatial rdf:parseType="Resource">
-<!--        
+<!--
           <rdfs:seeAlso rdf:parseType="Resource">
--->          
+-->
           <xsl:choose>
             <xsl:when test="$GeoURN != ''">
               <dct:identifier rdf:datatype="{$xsd}anyURI"><xsl:value-of select="$GeoURN"/></dct:identifier>
@@ -1434,28 +1740,28 @@
               </skos:ConceptScheme>
             </skos:inScheme>
           </xsl:for-each>
-<!--            
+<!--
           </rdfs:seeAlso>
--->          
+-->
         </dct:spatial>
       </xsl:when>
     </xsl:choose>
   </xsl:template>
 
-<!-- Geographic bounding box -->  
+<!-- Geographic bounding box -->
 
-<!--  
+<!--
   <xsl:template name="GeographicBoundingBox" match="gmd:identificationInfo[1]/*/*[self::gmd:extent|self::srv:extent]/*/gmd:geographicElement/gmd:EX_GeographicBoundingBox">
--->  
+-->
   <xsl:template name="GeographicBoundingBox" match="gmd:EX_GeographicBoundingBox">
     <xsl:param name="north" select="gmd:northBoundLatitude/gco:Decimal"/>
-    <xsl:param name="east"  select="gmd:eastBoundLongitude/gco:Decimal"/>
+    <xsl:param name="east" select="gmd:eastBoundLongitude/gco:Decimal"/>
     <xsl:param name="south" select="gmd:southBoundLatitude/gco:Decimal"/>
-    <xsl:param name="west"  select="gmd:westBoundLongitude/gco:Decimal"/>
+    <xsl:param name="west" select="gmd:westBoundLongitude/gco:Decimal"/>
 
 <!-- Bbox as a dct:Box -->
 <!-- Need to check whether this is correct - in particular, the "projection" parameter -->
-<!--    
+<!--
     <xsl:param name="DCTBox">northlimit=<xsl:value-of select="$north"/>; eastlimit=<xsl:value-of select="$east"/>; southlimit=<xsl:value-of select="$south"/>; westlimit=<xsl:value-of select="$west"/>; projection=EPSG:<xsl:value-of select="$srid"/></xsl:param>
 -->
 
@@ -1486,27 +1792,27 @@
 <!-- Recommended geometry encodings -->
       <locn:geometry rdf:datatype="{$gsp}wktLiteral"><xsl:value-of select="$WKTLiteral"/></locn:geometry>
       <locn:geometry rdf:datatype="{$gsp}gmlLiteral"><xsl:value-of select="$GMLLiteral"/></locn:geometry>
-<!-- Additional geometry encodings -->    
+<!-- Additional geometry encodings -->
       <locn:geometry rdf:datatype="{$geojsonMediaTypeUri}"><xsl:value-of select="$GeoJSONLiteral"/></locn:geometry>
 <!--
       <locn:geometry rdf:datatype="{$dct}Box"><xsl:value-of select="$DCTBox"/></locn:geometry>
--->    
+-->
     </dct:spatial>
   </xsl:template>
-  
-<!-- Temporal extent -->  
 
+<!-- Temporal extent -->
+
   <xsl:template name="TemporalExtent" match="gmd:identificationInfo/*/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent">
     <xsl:for-each select="gmd:extent/gml:TimeInstant|gmd:extent/gml:TimePeriod">
       <xsl:if test="local-name(.) = 'TimeInstant' or ( local-name(.) = 'TimePeriod' and gml:beginPosition and gml:endPosition )">
-<!--      
+<!--
         <xsl:variable name="dctperiod">
           <xsl:choose>
             <xsl:when test="local-name(.) = 'TimeInstant'">start=<xsl:value-of select="gml:timePosition"/>; end=<xsl:value-of select="gml:timePosition"/></xsl:when>
             <xsl:otherwise>start=<xsl:value-of select="gml:beginPosition"/>; end=<xsl:value-of select="gml:endPosition"/></xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
--->        
+-->
         <xsl:variable name="dateStart">
           <xsl:choose>
             <xsl:when test="local-name(.) = 'TimeInstant'"><xsl:value-of select="gml:timePosition"/></xsl:when>
@@ -1528,15 +1834,15 @@
       </xsl:if>
     </xsl:for-each>
   </xsl:template>
-  
-<!-- Dates of publication, last revision, creation -->  
 
+<!-- Dates of publication, last revision, creation -->
+
   <xsl:template name="ResourceDates" match="gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation">
     <xsl:apply-templates select="gmd:date/gmd:CI_Date"/>
   </xsl:template>
-  
-<!-- Generic date template -->  
 
+<!-- Generic date template -->
+
   <xsl:template name="Dates" match="gmd:date/gmd:CI_Date">
     <xsl:param name="date">
       <xsl:value-of select="gmd:date/gco:Date"/>
@@ -1555,7 +1861,7 @@
           <xsl:value-of select="$date"/>
         </dct:modified>
       </xsl:when>
-      <xsl:when test="$type = 'creation' and $profile = 'extended'">
+      <xsl:when test="$type = 'creation' and $profile = $extended">
         <dct:created rdf:datatype="{$xsd}date">
           <xsl:value-of select="$date"/>
         </dct:created>
@@ -1572,36 +1878,36 @@
     </xsl:param>
     <xsl:for-each select="gmd:useLimitation">
       <xsl:choose>
-<!-- In case the rights/licence URL IS NOT provided -->      
+<!-- In case the rights/licence URL IS NOT provided -->
         <xsl:when test="gco:CharacterString">
           <dct:license>
             <dct:LicenseDocument>
               <rdfs:label xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gco:CharacterString)"/></rdfs:label>
             </dct:LicenseDocument>
           </dct:license>
-<!--                                                                               
+<!--
           <dct:rights>
             <dct:RightsStatement>
               <rdfs:label xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gco:CharacterString)"/></rdfs:label>
             </dct:RightsStatement>
           </dct:rights>
--->          
+-->
         </xsl:when>
-<!-- In case the rights/licence URL IS provided -->      
+<!-- In case the rights/licence URL IS provided -->
         <xsl:when test="gmx:Anchor/@xlink:href">
           <dct:license rdf:resource="{gmx:Anchor/@xlink:href}"/>
-<!--        
+<!--
           <dct:license>
             <dct:LicenseDocument rdf:about="{gmx:Anchor/@xlink:href}">
               <rdfs:label xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gmx:Anchor)"/></rdfs:label>
             </dct:LicenseDocument>
           </dct:license>
--->          
+-->
         </xsl:when>
       </xsl:choose>
     </xsl:for-each>
     <xsl:for-each select="gmd:otherConstraints">
-      <xsl:if test="$profile = 'extended'">
+      <xsl:if test="$profile = $extended">
         <dct:accessRights>
           <dct:RightsStatement>
             <rdfs:label xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gco:CharacterString)"/></rdfs:label>
@@ -1609,18 +1915,18 @@
         </dct:accessRights>
       </xsl:if>
     </xsl:for-each>
-<!--    
+<!--
     <xsl:for-each select="gmd:accessConstraints">
       <dct:accessRights rdf:resource="{$MD_RestrictionCode}_{gmd:MD_RestrictionCode/@codeListValue}"/>
     </xsl:for-each>
     <xsl:for-each select="gmd:classification">
       <dct:accessRights rdf:resource="{$MD_ClassificationCode}_{gmd:MD_ClassificationCode/@codeListValue}"/>
     </xsl:for-each>
--->    
+-->
   </xsl:template>
-  
-<!-- Keyword -->  
 
+<!-- Keyword -->
+
   <xsl:template name="Keyword" match="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords">
     <xsl:param name="MetadataLanguage"/>
     <xsl:param name="ResourceType"/>
@@ -1636,10 +1942,10 @@
     <xsl:for-each select="gmd:keyword">
       <xsl:variable name="lckw" select="translate(gco:CharacterString,$uppercase,$lowercase)"/>
       <xsl:choose>
-        <xsl:when test="$OriginatingControlledVocabulary = ''">
+        <xsl:when test="$OriginatingControlledVocabulary = '' and not( gmx:Anchor/@xlink:href ) and ( starts-with(gmx:Anchor/@xlink:href, 'http://') or starts-with(gmx:Anchor/@xlink:href, 'https://') )">
           <xsl:choose>
             <xsl:when test="$ResourceType = 'service'">
-              <xsl:if test="$profile = 'extended'">
+              <xsl:if test="$profile = $extended">
                 <dc:subject xml:lang="{$MetadataLanguage}"><xsl:value-of select="gco:CharacterString"/></dc:subject>
               </xsl:if>
             </xsl:when>
@@ -1650,7 +1956,7 @@
         </xsl:when>
         <xsl:otherwise>
           <xsl:choose>
-<!-- In case the concept's URI is NOT provided -->              
+<!-- In case the concept's URI is NOT provided -->
             <xsl:when test="gco:CharacterString">
               <xsl:choose>
                 <xsl:when test="$ResourceType != 'service'">
@@ -1666,7 +1972,7 @@
                   </dcat:theme>
                 </xsl:when>
                 <xsl:otherwise>
-                  <xsl:if test="$profile = 'extended'">
+                  <xsl:if test="$profile = $extended">
                     <dct:subject rdf:parseType="Resource">
                       <skos:prefLabel xml:lang="{$MetadataLanguage}">
                         <xsl:value-of select="gco:CharacterString"/>
@@ -1681,12 +1987,12 @@
                 </xsl:otherwise>
               </xsl:choose>
             </xsl:when>
-<!-- In case the concept's URI is provided -->              
+<!-- In case the concept's URI is provided -->
             <xsl:when test="gmx:Anchor/@xlink:href">
               <xsl:choose>
                 <xsl:when test="$ResourceType != 'service'">
                   <dcat:theme rdf:resource="{gmx:Anchor/@xlink:href}"/>
-<!--              
+<!--
                   <skos:Concept rdf:about="{gmx:Anchor/@xlink:href}">
                     <skos:prefLabel xml:lang="{$MetadataLanguage}">
                       <xsl:value-of select="gmx:Anchor"/>
@@ -1697,10 +2003,10 @@
                       </skos:ConceptScheme>
                     </skos:inScheme>
                   </skos:Concept>
--->                
+-->
                 </xsl:when>
                 <xsl:otherwise>
-                  <xsl:if test="$profile = 'extended'">
+                  <xsl:if test="$profile = $extended">
                     <dct:subject rdf:resource="{gmx:Anchor/@xlink:href}"/>
                   </xsl:if>
                 </xsl:otherwise>
@@ -1722,7 +2028,7 @@
 <!-- Spatial resolution (unstable - to be replaced with a standard-based solution, when available) -->
 
   <xsl:template name="SpatialResolution" match="gmd:identificationInfo/*/gmd:spatialResolution/gmd:MD_Resolution">
-<!-- dcat:granularity is deprecated -->  
+<!-- dcat:granularity is deprecated -->
 <!--
     <xsl:for-each select="gmd:distance/gco:Distance">
       <dcat:granularity rdf:datatype="{$xsd}string"><xsl:value-of select="."/> <xsl:value-of select="@uom"/></dcat:granularity>
@@ -1730,7 +2036,7 @@
     <xsl:for-each select="gmd:equivalentScale/gmd:MD_RepresentativeFraction/gmd:denominator">
       <dcat:granularity rdf:datatype="{$xsd}string">1/<xsl:value-of select="gco:Integer"/></dcat:granularity>
     </xsl:for-each>
--->    
+-->
     <xsl:for-each select="gmd:distance/gco:Distance">
       <xsl:variable name="UoM">
         <xsl:choose>
@@ -1740,13 +2046,13 @@
           <xsl:when test="@uom = 'EPSG::9002' or @uom = 'urn:ogc:def:uom:EPSG::9002' or @uom = 'urn:ogc:def:uom:UCUM::[ft_i]' or @uom = 'urn:ogc:def:uom:OGC::[ft_i]'">
             <xsl:value-of select="concat('ft',' (', at uom,')')"/>
           </xsl:when>
-<!-- To be completed -->          
+<!-- To be completed -->
           <xsl:otherwise>
             <xsl:value-of select="@uom"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
-      <rdfs:comment xml:lang="en">Spatial resolution (distance): <xsl:value-of select="."/> <xsl:value-of select="$UoM"/></rdfs:comment>
+      <rdfs:comment xml:lang="en">Spatial resolution (distance): <xsl:value-of select="."/> <xsl:value-of select="$UoM"/></rdfs:comment>
     </xsl:for-each>
     <xsl:for-each select="gmd:equivalentScale/gmd:MD_RepresentativeFraction/gmd:denominator">
       <rdfs:comment xml:lang="en">Spatial resolution (equivalent scale): 1:<xsl:value-of select="gco:Integer"/></rdfs:comment>
@@ -1850,9 +2156,9 @@
       </xsl:choose>
     </xsl:variable>
     <cnt:characterEncoding rdf:datatype="{$xsd}string"><xsl:value-of select="$CharSetCode"/></cnt:characterEncoding>
-<!--  
+<!--
     <cnt:characterEncoding rdf:datatype="{$xsd}string"><xsl:value-of select="@codeListValue"/></cnt:characterEncoding>
--->    
+-->
   </xsl:template>
 
 <!-- Encoding -->
@@ -1861,13 +2167,13 @@
     <xsl:choose>
       <xsl:when test="@xlink:href and @xlink:href != ''">
         <dct:format rdf:resource="{@xlink:href}"/>
-<!--        
+<!--
         <dct:format>
           <rdf:Description rdf:about="{@xlink:href}">
             <rdfs:label><xsl:value-of select="."/></rdfs:label>
           </rdf:Description>
         </dct:format>
--->        
+-->
       </xsl:when>
       <xsl:otherwise>
         <dct:format rdf:parseType="Resource">
@@ -1876,7 +2182,7 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-  
+
 <!-- Maintenance information -->
 
   <xsl:template name="MaintenanceInformation" match="gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode">
@@ -1885,74 +2191,74 @@
       <xsl:if test="@codeListValue != ''">
         <xsl:choose>
           <xsl:when test="@codeListValue = 'continual'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
              <xsl:value-of select="concat($cldFrequency,'continuous')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'CONT')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'daily'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'daily')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'DAILY')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'weekly'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'weekly')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'WEEKLY')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'fortnightly'">
-<!--  DC Freq voc       
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'biweekly')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'BIWEEKLY')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'monthly'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'monthly')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'MONTHLY')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'quarterly'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'quarterly')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'QUARTERLY')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'biannually'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'semiannual')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'ANNUAL_2')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'annually'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'annual')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'ANNUAL')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'asNeeded'">
-<!--  A mapping is missing in Dublin Core -->          
-<!--  A mapping is missing in MDR Freq NAL -->          
+<!--  A mapping is missing in Dublin Core -->
+<!--  A mapping is missing in MDR Freq NAL -->
             <xsl:value-of select="concat($MaintenanceFrequencyCodelistUri,'/', at codeListValue)"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'irregular'">
-<!--  DC Freq voc        
+<!--  DC Freq voc
             <xsl:value-of select="concat($cldFrequency,'irregular')"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'IRREG')"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'notPlanned'">
-<!--  A mapping is missing in Dublin Core -->          
-<!--  A mapping is missing in MDR Freq NAL -->          
+<!--  A mapping is missing in Dublin Core -->
+<!--  A mapping is missing in MDR Freq NAL -->
             <xsl:value-of select="concat($MaintenanceFrequencyCodelistUri,'/', at codeListValue)"/>
           </xsl:when>
           <xsl:when test="@codeListValue = 'unknown'">
-<!--  A mapping is missing in Dublin Core -->          
+<!--  A mapping is missing in Dublin Core -->
 <!--  INSPIRE Freq code list (not yet available)
             <xsl:value-of select="concat($MaintenanceFrequencyCodelistUri,'/', at codeListValue)"/>
--->            
+-->
             <xsl:value-of select="concat($opfq,'UNKNOWN')"/>
           </xsl:when>
         </xsl:choose>
@@ -1960,7 +2266,7 @@
     </xsl:param>
     <xsl:if test="$FrequencyCodeURI != ''">
       <dct:accrualPeriodicity rdf:resource="{$FrequencyCodeURI}"/>
-    </xsl:if>      
+    </xsl:if>
   </xsl:template>
 
 <!-- Coordinate and temporal reference system (tentative) -->
@@ -1979,17 +2285,21 @@
         </dct:conformsTo>
       </xsl:when>
       <xsl:when test="starts-with($code, 'urn:')">
+        <xsl:variable name="srid">
+          <xsl:if test="starts-with(translate($code,$uppercase,$lowercase), translate($EpsgSrsBaseUrn,$uppercase,$lowercase))">
+            <xsl:value-of select="substring-after(substring-after(substring-after(substring-after(substring-after(substring-after($code,':'),':'),':'),':'),':'),':')"/>
+          </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="sridVersion" select="substring-before(substring-after(substring-after(substring-after(substring-after(substring-after($code,':'),':'),':'),':'),':'),':')"/>
         <xsl:choose>
-          <xsl:when test="starts-with(translate($code,$uppercase,$lowercase), translate($EpsgSrsBaseUrn,$uppercase,$lowercase))">
-            <xsl:variable name="srid" select="substring-after(substring-after(substring-after(substring-after(substring-after(substring-after($code,':'),':'),':'),':'),':'),':')"/>
-            <xsl:variable name="sridVersion" select="substring-before(substring-after(substring-after(substring-after(substring-after(substring-after($code,':'),':'),':'),':'),':'),':')"/>
+          <xsl:when test="$srid != '' and string(number($srid)) != 'NaN'">
             <dct:conformsTo>
-              <rdf:Description rdf:about="{$EpsgSrsBaseUri}{$srid}">
+              <rdf:Description rdf:about="{$EpsgSrsBaseUri}/{$srid}">
                 <dct:type rdf:resource="{$INSPIREGlossaryUri}SpatialReferenceSystem"/>
                 <dct:identifier rdf:datatype="{$xsd}anyURI"><xsl:value-of select="$code"/></dct:identifier>
                 <skos:inScheme>
                   <skos:ConceptScheme rdf:about="{$EpsgSrsBaseUri}">
-                    <dct:title xml:lang="en">EPSG</dct:title>
+                    <dct:title xml:lang="en"><xsl:value-of select="$EpsgSrsName"/></dct:title>
                   </skos:ConceptScheme>
                 </skos:inScheme>
                 <xsl:if test="$sridVersion != ''">
@@ -2020,12 +2330,12 @@
         <xsl:choose>
           <xsl:when test="$code = number($code) and (translate($codespace,$uppercase,$lowercase) = 'epsg' or starts-with(translate($codespace,$uppercase,$lowercase),translate($EpsgSrsBaseUrn,$uppercase,$lowercase)))">
             <dct:conformsTo>
-              <rdf:Description rdf:about="{$EpsgSrsBaseUri}{$code}">
+              <rdf:Description rdf:about="{$EpsgSrsBaseUri}/{$code}">
                 <dct:type rdf:resource="{$INSPIREGlossaryUri}SpatialReferenceSystem"/>
                 <dct:identifier rdf:datatype="{$xsd}anyURI"><xsl:value-of select="concat($EpsgSrsBaseUrn,':',$version,':',$code)"/></dct:identifier>
                 <skos:inScheme>
                   <skos:ConceptScheme rdf:about="{$EpsgSrsBaseUri}">
-                    <dct:title xml:lang="en">EPSG</dct:title>
+                    <dct:title xml:lang="en"><xsl:value-of select="$EpsgSrsName"/></dct:title>
                   </skos:ConceptScheme>
                 </skos:inScheme>
                 <xsl:if test="$version != ''">
@@ -2042,7 +2352,7 @@
                 <skos:prefLabel xml:lang="en">ETRS89 - European Terrestrial Reference System 1989</skos:prefLabel>
                 <skos:inScheme>
                   <skos:ConceptScheme rdf:about="{$EpsgSrsBaseUri}">
-                    <dct:title xml:lang="en">EPSG</dct:title>
+                    <dct:title xml:lang="en"><xsl:value-of select="$EpsgSrsName"/></dct:title>
                   </skos:ConceptScheme>
                 </skos:inScheme>
                 <xsl:if test="$version != ''">
@@ -2059,7 +2369,7 @@
                 <skos:prefLabel xml:lang="en">CRS84</skos:prefLabel>
                 <skos:inScheme>
                   <skos:ConceptScheme rdf:about="{$OgcSrsBaseUri}">
-                    <dct:title xml:lang="en">OGC</dct:title>
+                    <dct:title xml:lang="en"><xsl:value-of select="$OgcSrsName"/></dct:title>
                   </skos:ConceptScheme>
                 </skos:inScheme>
                 <xsl:if test="$version != ''">
@@ -2095,4 +2405,4 @@
     <adms:representationTechnique rdf:resource="{$SpatialRepresentationTypeCodelistUri}/{@codeListValue}"/>
   </xsl:template>
 
-</xsl:transform>
+</xsl:transform>
\ No newline at end of file



More information about the Mapbender_commits mailing list