forked from SEMICeu/iso-19139-to-dcat-ap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iso-19139-to-dcat-ap.xsl
4338 lines (4082 loc) · 182 KB
/
iso-19139-to-dcat-ap.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015-2023 EUROPEAN UNION
Licensed under the EUPL, Version 1.2 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:
https://joinup.ec.europa.eu/collection/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.
Contributors: GeoDCAT-AP Working Group (https://github.com/SEMICeu/geodcat-ap)
This work was originally 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
(http://ec.europa.eu/isa/actions/01-trusted-information-exchange/1-17action_en.htm).
Source code: https://github.com/SEMICeu/iso-19139-to-dcat-ap
-->
<!--
PURPOSE AND USAGE
This XSLT is a proof of concept for the implementation of the latest version
of the geospatial profile of DCAT-AP (GeoDCAT-AP):
https://semiceu.github.io/GeoDCAT-AP/releases/
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.
The official distributions of this XSLT are published in the dedicated GitHub
repository:
https://github.com/SEMICeu/iso-19139-to-dcat-ap
Comments and inquiries should be sent via the corresponding issue tracker:
https://github.com/SEMICeu/iso-19139-to-dcat-ap/issues
-->
<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:dqv = "http://www.w3.org/ns/dqv#"
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:geodcatap = "http://data.europa.eu/930/"
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:sdmx-attribute = "http://purl.org/linked-data/sdmx/2009/attribute#"
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="2.0">
<xsl:output method="xml"
indent="yes"
encoding="utf-8"
cdata-section-elements="locn:geometry dcat:bbox" />
<!--
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>
<xsl:variable name="core">http://data.europa.eu/r5r/</xsl:variable>
<xsl:variable name="extended">http://data.europa.eu/930/</xsl:variable>
-->
<xsl:variable name="profile-core-code">core</xsl:variable>
<xsl:variable name="profile-extended-code">extended</xsl:variable>
<xsl:variable name="profile-core-uri">http://data.europa.eu/r5r/</xsl:variable>
<xsl:variable name="profile-extended-uri">http://data.europa.eu/930/</xsl:variable>
<!--
Mapping parameters
==================
This section includes mapping parameters by the XSLT processor used, or, possibly, manually.
-->
<!-- Parameter $profile -->
<!--
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/solution/geodcat-ap
-->
<!-- Uncomment to use GeoDCAT-AP Core as default profile -->
<!--
<xsl:variable name="default-profile" select="$profile-core-uri"/>
-->
<!-- Uncomment to use GeoDCAT-AP Extended as default profile -->
<xsl:variable name="default-profile" select="$profile-extended-uri"/>
<xsl:param name="profile" select="$default-profile"/>
<xsl:variable name="selected-profile">
<xsl:choose>
<xsl:when test="$profile = $profile-core-code">
<xsl:value-of select="$profile-core-uri"/>
</xsl:when>
<xsl:when test="$profile = $profile-core-uri">
<xsl:value-of select="$profile"/>
</xsl:when>
<xsl:when test="$profile = $profile-extended-code">
<xsl:value-of select="$profile-extended-uri"/>
</xsl:when>
<xsl:when test="$profile = $profile-extended-uri">
<xsl:value-of select="$profile"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default-profile"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="core">
<xsl:choose>
<xsl:when test="$profile = $profile-core-code">
<xsl:value-of select="$profile-core-code"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$profile-core-uri"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="extended">
<xsl:choose>
<xsl:when test="$profile = $profile-extended-code">
<xsl:value-of select="$profile-extended-code"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$profile-extended-uri"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Parameter $include-deprecated -->
<!--
This parameter specifies whether deprecated mappings must ("yes") or must not
("no") be included in the output.
-->
<!-- Uncomment to include deprecated mappings from the output -->
<xsl:param name="include-deprecated">yes</xsl:param>
<!-- Uncomment to exclude deprecated mappings from the output -->
<!--
<xsl:param name="include-deprecated">no</xsl:param>
-->
<!-- 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, 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="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="Crs84Urn" select="concat($OgcSrsBaseUrn,':1.3:CRS84')"/>
<!-- URI and URN for ETRS89. -->
<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
$SrsAxisOrder must be specified. -->
<!-- The SRS URI is used in the WKT and GML encodings of the bounding box. -->
<xsl:param name="SrsUri" select="$Crs84Uri"/>
<!-- 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:
- "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. -->
<xsl:param name="SrsAxisOrder">LonLat</xsl:param>
<!-- Namespaces -->
<!-- Currently not used.
<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="dct">http://purl.org/dc/terms/</xsl:param>
<xsl:param name="dctype">http://purl.org/dc/dcmitype/</xsl:param>
<xsl:param name="foaf">http://xmlns.com/foaf/0.1/</xsl:param>
<xsl:param name="geodcatap">http://data.europa.eu/930/</xsl:param>
<xsl:param name="gsp">http://www.opengis.net/ont/geosparql#</xsl:param>
<xsl:param name="prov">http://www.w3.org/ns/prov#</xsl:param>
<xsl:param name="skos">http://www.w3.org/2004/02/skos/core#</xsl:param>
<xsl:param name="vcard">http://www.w3.org/2006/vcard/ns#</xsl:param>
<xsl:param name="xsd">http://www.w3.org/2001/XMLSchema#</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/')"/>
<xsl:param name="kosdst" select="concat($kos,'dataset-type/')"/>
<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')"/>
-->
<!-- OP's NALs base URI -->
<xsl:param name="op">http://publications.europa.eu/resource/authority/</xsl:param>
<!-- OP's NALs URIs -->
<xsl:param name="opcb" select="concat($op,'corporate-body/')"/>
<xsl:param name="opcountry" select="concat($op,'country/')"/>
<xsl:param name="opfq" select="concat($op,'frequency/')"/>
<xsl:param name="opft" select="concat($op,'file-type/')"/>
<xsl:param name="oplang" select="concat($op,'language/')"/>
<!-- Currently not used.
<xsl:param name="cldFrequency">http://purl.org/cld/freq/</xsl:param>
-->
<!-- IANA base URI -->
<xsl:param name="iana">https://www.iana.org/assignments/</xsl:param>
<!-- IANA registers URIs -->
<xsl:param name="iana-mt" select="concat($iana,'media-types/')"/>
<!-- DEPRECATED: Parameter kept for backward compatibility with GeoDCAT-AP v1.* -->
<!-- This is used as the datatype for the GeoJSON-based encoding of the bounding box. -->
<xsl:param name="geojsonMediaTypeUri" select="concat($iana-mt,'application/vnd.geo+json')"/>
<!-- QUDT Units Vocabulary -->
<xsl:param name="qudt-unit">http://www.qudt.org/vocab/unit</xsl:param>
<!-- Ontology for units of measure (OM) -->
<xsl:param name="om18">http://www.wurvoc.org/vocabularies/om-1.8</xsl:param>
<xsl:param name="om2">http://www.ontology-of-units-of-measure.org/resource/om-2</xsl:param>
<xsl:param name="om" select="$om18"/>
<!-- Units of measure -->
<xsl:param name="uom-m" select="concat($qudt-unit, '/', 'M')"/>
<xsl:param name="uom-km" select="concat($qudt-unit, '/', 'KiloM')"/>
<xsl:param name="uom-ft" select="concat($qudt-unit, '/', 'FT')"/>
<xsl:param name="uom-deg" select="concat($qudt-unit, '/', 'DEG')"/>
<!--
<xsl:param name="uom-m" select="concat($om, '/', 'metre')"/>
<xsl:param name="uom-km" select="concat($om, '/', 'kilometre')"/>
<xsl:param name="uom-ft">
<xsl:choose>
<xsl:when test="$om = $om18">
<xsl:value-of select="concat($om, '/', 'foot-international')"/>
</xsl:when>
<xsl:when test="$om = $om2">
<xsl:value-of select="concat($om, '/', 'foot-International')"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="uom-deg" select="concat($om, '/', 'degree')"/>
-->
<!-- INSPIRE base URI -->
<xsl:param name="inspire">http://inspire.ec.europa.eu/</xsl:param>
<!-- INSPIRE metadata code list URIs -->
<xsl:param name="INSPIRECodelistUri" select="concat($inspire,'metadata-codelist/')"/>
<xsl:param name="SpatialDataServiceCategoryCodelistUri" select="concat($INSPIRECodelistUri,'SpatialDataServiceCategory')"/>
<xsl:param name="DegreeOfConformityCodelistUri" select="concat($INSPIRECodelistUri,'DegreeOfConformity')"/>
<xsl:param name="ResourceTypeCodelistUri" select="concat($INSPIRECodelistUri,'ResourceType')"/>
<xsl:param name="ResponsiblePartyRoleCodelistUri" select="concat($INSPIRECodelistUri,'ResponsiblePartyRole')"/>
<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) -->
<!-- DEPRECATED following the publication of the relevant code list in the INSPIRE Registry
<xsl:param name="SpatialRepresentationTypeCodelistUri" select="concat($INSPIRECodelistUri,'SpatialRepresentationTypeCode')"/>
<xsl:param name="MaintenanceFrequencyCodelistUri" select="concat($INSPIRECodelistUri,'MaintenanceFrequencyCode')"/>
-->
<xsl:param name="SpatialRepresentationTypeCodelistUri" select="concat($INSPIRECodelistUri,'SpatialRepresentationType')"/>
<xsl:param name="MaintenanceFrequencyCodelistUri" select="concat($INSPIRECodelistUri,'MaintenanceFrequency')"/>
<!-- INSPIRE glossary URI -->
<xsl:param name="INSPIREGlossaryUri" select="concat($inspire,'glossary/')"/>
<!-- INSPIRE glossary URI -->
<xsl:param name="inspire-mt" select="concat($inspire,'media-types/')"/>
<!--
Master template
===============
-->
<xsl:template match="/">
<rdf:RDF>
<xsl:apply-templates select="gmd:MD_Metadata|//gmd:MD_Metadata"/>
</rdf:RDF>
</xsl: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
=====================================================================================
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).
Resource URI can be an http or https URI based on:
* codeSpace + code value
* code value
The first URI found is used.
-->
<xsl:param name="ResourceUri">
<xsl:variable name="identifiers"
select="gmd:identificationInfo/*/gmd:citation/*/
gmd:identifier/*"/>
<xsl:variable name="uriIdentifiers"
as="node()*">
<xsl:for-each select="$identifiers">
<xsl:variable name="rURI"
select="if (gmd:codeSpace)
then concat(
gmd:codeSpace/(gco:CharacterString
|gmx:Anchor/@xlink:href),
gmd:code/(gco:CharacterString
|gmx:Anchor/@xlink:href))
else gmd:code/(gco:CharacterString/text()
|gmx:Anchor/@xlink:href)"/>
<xsl:if test="matches($rURI, '^https?://')">
<uri><xsl:value-of select="$rURI"/></uri>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="count($uriIdentifiers) > 0">
<xsl:value-of select="$uriIdentifiers[1]"/>
<xsl:if test="count($uriIdentifiers) > 1">
<xsl:message>ResourceUri is <xsl:value-of select="$uriIdentifiers[1]"/>. Ignored: <xsl:value-of select="string-join($uriIdentifiers[position() > 1], ',')"/>. </xsl:message>
</xsl:if>
</xsl:if>
</xsl:param>
<xsl:param name="MetadataUri">
<xsl:variable name="mURI" select="gmd:fileIdentifier/gco:CharacterString"/>
<xsl:if test="$mURI != '' and ( starts-with($mURI, 'http://') or starts-with($mURI, 'https://') )">
<xsl:value-of select="$mURI"/>
</xsl:if>
</xsl:param>
<!--
Other parameters
================
-->
<!-- Metadata language: corresponding Alpha-2 codes -->
<xsl:param name="ormlang">
<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'">
<xsl:text>bg</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'cze'">
<xsl:text>cs</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'dan'">
<xsl:text>da</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'ger'">
<xsl:text>de</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'gre'">
<xsl:text>el</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'eng'">
<xsl:text>en</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'spa'">
<xsl:text>es</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'est'">
<xsl:text>et</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'fin'">
<xsl:text>fi</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'fre'">
<xsl:text>fr</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'gle'">
<xsl:text>ga</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'hrv'">
<xsl:text>hr</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'ita'">
<xsl:text>it</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'lav'">
<xsl:text>lv</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'lit'">
<xsl:text>lt</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'hun'">
<xsl:text>hu</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'mlt'">
<xsl:text>mt</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'dut'">
<xsl:text>nl</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'pol'">
<xsl:text>pl</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'por'">
<xsl:text>pt</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'rum'">
<xsl:text>ru</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'slo'">
<xsl:text>sk</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'slv'">
<xsl:text>sl</xsl:text>
</xsl:when>
<xsl:when test="$ormlang = 'swe'">
<xsl:text>sv</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ormlang"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<!-- Resource language: corresponding Alpha-2 codes -->
<xsl:param name="orrlang">
<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'">
<xsl:text>bg</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'cze'">
<xsl:text>cs</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'dan'">
<xsl:text>da</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'ger'">
<xsl:text>de</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'gre'">
<xsl:text>el</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'eng'">
<xsl:text>en</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'spa'">
<xsl:text>es</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'est'">
<xsl:text>et</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'fin'">
<xsl:text>fi</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'fre'">
<xsl:text>fr</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'gle'">
<xsl:text>ga</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'hrv'">
<xsl:text>hr</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'ita'">
<xsl:text>it</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'lav'">
<xsl:text>lv</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'lit'">
<xsl:text>lt</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'hun'">
<xsl:text>hu</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'mlt'">
<xsl:text>mt</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'dut'">
<xsl:text>nl</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'pol'">
<xsl:text>pl</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'por'">
<xsl:text>pt</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'rum'">
<xsl:text>ru</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'slo'">
<xsl:text>sk</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'slv'">
<xsl:text>sl</xsl:text>
</xsl:when>
<xsl:when test="$orrlang = 'swe'">
<xsl:text>sv</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$orrlang"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="IsoScopeCode">
<xsl:value-of select="normalize-space(gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue)"/>
</xsl:param>
<xsl:param name="InspireResourceType">
<xsl:if test="$IsoScopeCode = 'dataset' or $IsoScopeCode = 'series' or $IsoScopeCode = 'service'">
<xsl:value-of select="$IsoScopeCode"/>
</xsl:if>
</xsl:param>
<xsl:param name="ResourceType">
<xsl:choose>
<xsl:when test="$IsoScopeCode = 'dataset' or $IsoScopeCode = 'nonGeographicDataset'">
<xsl:text>dataset</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$IsoScopeCode"/>
</xsl:otherwise>
</xsl:choose>
</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>
-->
<xsl:param name="ResourceTitle">
<xsl:for-each select="gmd:identificationInfo[1]/*/gmd:citation/*/gmd:title">
<dct:title xml:lang="{$MetadataLanguage}">
<xsl:value-of select="normalize-space(gco:CharacterString)"/>
</dct:title>
<xsl:call-template name="LocalisedString">
<xsl:with-param name="term">dct:title</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:param>
<!--
<xsl:param name="ResourceAbstract">
<xsl:value-of select="gmd:identificationInfo[1]/*/gmd:abstract/gco:CharacterString"/>
</xsl:param>
-->
<xsl:param name="ResourceAbstract">
<xsl:for-each select="gmd:identificationInfo[1]/*/gmd:abstract">
<dct:description xml:lang="{$MetadataLanguage}">
<xsl:value-of select="normalize-space(gco:CharacterString)"/>
</dct:description>
<xsl:call-template name="LocalisedString">
<xsl:with-param name="term">dct:description</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:param>
<!--
<xsl:param name="Lineage">
<xsl:value-of select="gmd:dataQualityInfo/*/gmd:lineage/*/gmd:statement/gco:CharacterString"/>
</xsl:param>
-->
<xsl:param name="Lineage">
<xsl:for-each select="gmd:dataQualityInfo/*/gmd:lineage/*/gmd:statement">
<dct:provenance>
<dct:ProvenanceStatement>
<dct:description xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gco:CharacterString)"/></dct:description>
<xsl:call-template name="LocalisedString">
<xsl:with-param name="term">dct:description</xsl:with-param>
</xsl:call-template>
</dct:ProvenanceStatement>
</dct:provenance>
</xsl:for-each>
</xsl:param>
<xsl:param name="MetadataDate">
<xsl:choose>
<xsl:when test="gmd:dateStamp/gco:Date">
<xsl:value-of select="gmd:dateStamp/gco:Date"/>
</xsl:when>
<xsl:when test="gmd:dateStamp/gco:DateTime">
<!--
<xsl:value-of select="substring(gmd:dateStamp/gco:DateTime/text(),1,10)"/>
-->
<xsl:value-of select="normalize-space(gmd:dateStamp/gco:DateTime/text())"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="UniqueResourceIdentifier">
<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(gmd:codeSpace/gco:CharacterString/text(),gmd:code/gco:CharacterString/text())"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="gmd:code/gco:CharacterString/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:param>
<xsl:param name="ConstraintsRelatedToAccessAndUse">
<xsl:apply-templates select="gmd:identificationInfo[1]/*/gmd:resourceConstraints/*">
<xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
</xsl:apply-templates>
</xsl:param>
<!-- 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">
<dct:title xml:lang="{$MetadataLanguage}">
<xsl:value-of select="gmd:title/gco:CharacterString"/>
</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'">
<xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/conformant')"/>
</xsl:when>
<xsl:when test="../../gmd:pass/gco:Boolean = 'false'">
<xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notConformant')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/notEvaluated')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="explanation">
<xsl:value-of select="../../gmd:explanation/gco:CharacterString"/>
</xsl:variable>
<earl:Assertion>
<xsl:if test="$ResourceUri != ''">
<earl:subject rdf:resource="{$ResourceUri}"/>
</xsl:if>
<xsl:choose>
<xsl:when test="../@xlink:href and ../@xlink:href != ''">
<earl:test>
<rdf:Description rdf:about="{../@xlink:href}">
<xsl:copy-of select="$specinfo"/>
</rdf:Description>
</earl:test>
</xsl:when>
<xsl:otherwise>
<earl:test rdf:parseType="Resource">
<xsl:copy-of select="$specinfo"/>
</earl:test>
</xsl:otherwise>
</xsl:choose>
<earl:result>
<earl:TestResult>
<earl:outcome rdf:resource="{$degree}"/>
<xsl:if test="$explanation and $explanation != ''">
<earl:info xml:lang="{$MetadataLanguage}"><xsl:value-of select="$explanation"/></earl:info>
</xsl:if>
</earl:TestResult>
</earl:result>
</earl:Assertion>
</xsl:for-each>
</xsl:param>
-->
<!-- 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="specUri" select="normalize-space(gmd:title/gmx:Anchor/@xlink:href)"/>
<xsl:variable name="specTitle">
<xsl:for-each select="gmd:title">
<!--
<dct:title xml:lang="{$MetadataLanguage}"><xsl:value-of select="normalize-space(gco:CharacterString)"/></dct:title>
-->
<dct:title xml:lang="{$MetadataLanguage}">
<xsl:value-of select="normalize-space(*[self::gco:CharacterString|self::gmx:Anchor])"/>
</dct:title>
<xsl:call-template name="LocalisedString">
<xsl:with-param name="term">dct:title</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="specinfo">
<!--
<dct:title xml:lang="{$MetadataLanguage}">
<xsl:value-of select="gmd:title/gco:CharacterString"/>
</dct:title>
-->
<xsl:copy-of select="$specTitle"/>
<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'">
<xsl:value-of select="concat($DegreeOfConformityCodelistUri,'/conformant')"/>
</xsl:when>
<xsl:when test="../../gmd:pass/gco:Boolean = 'false'">
<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:variable name="explanation">
<xsl:value-of select="../../gmd:explanation/gco:CharacterString"/>
</xsl:variable>
-->
<xsl:variable name="explanation">
<xsl:for-each select="../../gmd:explanation">
<dct:description xml:lang="{$MetadataLanguage}">
<xsl:value-of select="normalize-space(gco:CharacterString)"/>
</dct:description>
<xsl:call-template name="LocalisedString">
<xsl:with-param name="term">dct:description</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="Activity">
<prov:Activity>
<xsl:if test="$ResourceUri != ''">
<prov:used>
<prov:Entity rdf:about="{$ResourceUri}"/>
</prov:used>
</xsl:if>
<prov:qualifiedAssociation rdf:parseType="Resource">
<rdf:type rdf:resource="{$prov}Association"/>
<prov:hadPlan rdf:parseType="Resource">
<rdf:type rdf:resource="{$prov}Plan"/>
<xsl:choose>
<xsl:when test="$specUri != ''">
<prov:wasDerivedFrom>
<prov:Entity rdf:about="{$specUri}"/>
</prov:wasDerivedFrom>
<!--
<prov:wasDerivedFrom>
<rdf:Description rdf:about="{$specUri}">
<xsl:copy-of select="$specinfo"/>
</rdf:Description>
</prov:wasDerivedFrom>
-->
</xsl:when>
<xsl:when test="../@xlink:href and ../@xlink:href != ''">
<prov:wasDerivedFrom>
<prov:Entity rdf:about="{../@xlink:href}"/>
</prov:wasDerivedFrom>
<!--
<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">
<rdf:type rdf:resource="{$prov}Entity"/>
<xsl:copy-of select="$specinfo"/>
</prov:wasDerivedFrom>
</xsl:otherwise>
</xsl:choose>
</prov:hadPlan>
</prov:qualifiedAssociation>
<prov:generated rdf:parseType="Resource">
<rdf:type rdf:resource="{$prov}Entity"/>
<dct:type rdf:resource="{$degree}"/>
<!--
<xsl:if test="$explanation and $explanation != ''">
<dct:description xml:lang="{$MetadataLanguage}"><xsl:value-of select="$explanation"/></dct:description>
</xsl:if>
-->
<xsl:copy-of select="$explanation"/>
</prov:generated>
</prov:Activity>
</xsl:variable>
<!--
<xsl:choose>
<xsl:when test="$ResourceUri != ''">
<xsl:copy-of select="$Activity"/>
</xsl:when>
<xsl:otherwise>
-->
<prov:wasUsedBy>
<xsl:copy-of select="$Activity"/>
</prov:wasUsedBy>
<!--
</xsl:otherwise>
</xsl:choose>
-->
</xsl:for-each>
</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>
<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:param>
<!-- Metadata description (metadata on metadata) -->
<xsl:param name="MetadataDescription">
<rdf:type rdf:resource="{$dcat}CatalogRecord"/>
<xsl:if test="$ResourceUri != ''">
<foaf:primaryTopic rdf:resource="{$ResourceUri}"/>
</xsl:if>
<!-- Metadata standard -->
<dct:conformsTo>