Skip to content

Commit 7ccdad4

Browse files
committed
Formatter / DCAT / Update SEMIC-EU XSLT.
1 parent 5fbf5d0 commit 7ccdad4

2 files changed

Lines changed: 103 additions & 38 deletions

File tree

schemas/iso19139/src/main/plugin/iso19139/formatter/eu-geodcat-ap-semiceu/view.xsl

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
xmlns:vcard = "http://www.w3.org/2006/vcard/ns#"
8585
xmlns:wdrs = "http://www.w3.org/2007/05/powder-s#"
8686
xmlns:xlink = "http://www.w3.org/1999/xlink"
87-
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
87+
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
8888
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
8989
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
9090
exclude-result-prefixes="#all"
@@ -197,10 +197,8 @@
197197
This parameter specifies the prefix (can be empty) used in ISO 19139 language tags
198198
-->
199199

200-
<!-- <xsl:param name="locale-prefix">locale-</xsl:param>-->
201-
<!-- GeoNetwork does not set any prefix by default.
202-
Another approach would be to get the language id ref from the metadata language elements. -->
203-
<xsl:param name="locale-prefix"></xsl:param>
200+
201+
<xsl:param name="locale-prefix">locale-</xsl:param>
204202

205203
<!-- Parameter $locale-default-lang -->
206204
<!--
@@ -215,7 +213,6 @@
215213
This parameter specifies whether deprecated mappings must ("yes") or must not
216214
("no") be included in the output.
217215
-->
218-
219216
<!-- Uncomment to include deprecated mappings from the output -->
220217

221218
<xsl:param name="include-deprecated">yes</xsl:param>
@@ -458,11 +455,9 @@
458455
<!-- Handle PT_FreeText with LocalisedCharacterStrings -->
459456
<xsl:when test="$element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString">
460457
<xsl:choose>
461-
<!-- <xsl:when test="$element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale = $localeId]">
462-
<xsl:value-of select="normalize-space($element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale = $localeId][1])"/>
463-
</xsl:when>-->
464-
<xsl:when test="$element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#locale-en']">
465-
<xsl:value-of select="normalize-space($element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#locale-en'][1])"/>
458+
<!-- Try to find English locale first -->
459+
<xsl:when test="$element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#{$locale-prefix}{$locale-default-lang}']">
460+
<xsl:value-of select="normalize-space($element/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#${locale-prefix}{$locale-default-lang}'][1])"/>
466461
</xsl:when>
467462
<!-- Otherwise use the first available LocalisedCharacterString -->
468463
<xsl:otherwise>
@@ -487,7 +482,7 @@
487482
<xsl:template match="/">
488483
<rdf:RDF>
489484
<xsl:apply-templates mode="iso19139-to-dcatap"
490-
select="gmd:MD_Metadata|//gmd:MD_Metadata"/>
485+
select="gmd:MD_Metadata|//gmd:MD_Metadata"/>
491486
</rdf:RDF>
492487
</xsl:template>
493488

@@ -499,8 +494,8 @@
499494
-->
500495

501496
<xsl:template mode="iso19139-to-dcatap"
502-
match="gmd:MD_Metadata|//gmd:MD_Metadata"
503-
priority="10">
497+
match="gmd:MD_Metadata|//gmd:MD_Metadata"
498+
priority="10">
504499

505500
<!--
506501
@@ -780,7 +775,9 @@
780775
</xsl:otherwise>
781776
</xsl:choose>
782777
</xsl:param>
783-
778+
<xsl:param name="ServiceCategory">
779+
<xsl:value-of select="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gmx:Anchor[starts-with(@xlink:href, $SpatialDataServiceCategoryCodelistUri)]/@xlink:href"/>
780+
</xsl:param>
784781
<xsl:param name="ServiceType">
785782
<xsl:value-of select="gmd:identificationInfo/*/srv:serviceType/gco:LocalName"/>
786783
</xsl:param>
@@ -1251,9 +1248,9 @@
12511248
-->
12521249
<xsl:copy-of select="$ResourceTitle"/>
12531250
<!--
1254-
<dct:description xml:lang="{$MetadataLanguage}">
1251+
<dct:description xml:lang="{$MetadataLanguage}">
12551252
<xsl:value-of select="$ResourceAbstract"/>
1256-
</dct:description>
1253+
</dct:description>
12571254
-->
12581255
<xsl:copy-of select="$ResourceAbstract"/>
12591256
<xsl:copy-of select="$ResourcePurpose"/>
@@ -1271,7 +1268,6 @@
12711268
<xsl:apply-templates mode="iso19139-to-dcatap" select="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords">
12721269
<xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
12731270
<xsl:with-param name="ResourceType" select="$ResourceType"/>
1274-
<xsl:with-param name="ServiceType" select="$ServiceType"/>
12751271
</xsl:apply-templates>
12761272
<!-- Identifier, 0..1 -->
12771273
<!--
@@ -1298,9 +1294,9 @@
12981294
<xsl:choose>
12991295
<xsl:when test="$orrlang[1]">
13001296
<xsl:for-each select="$orrlang">
1301-
<dct:language>
1302-
<dct:LinguisticSystem rdf:about="{concat($oplang,translate(.,$lowercase,$uppercase))}"/>
1303-
</dct:language>
1297+
<dct:language>
1298+
<dct:LinguisticSystem rdf:about="{concat($oplang,translate(.,$lowercase,$uppercase))}"/>
1299+
</dct:language>
13041300
</xsl:for-each>
13051301
</xsl:when>
13061302
<xsl:otherwise>
@@ -1325,6 +1321,9 @@
13251321
<xsl:with-param name="MetadataLanguage" select="$MetadataLanguage"/>
13261322
</xsl:apply-templates>
13271323
-->
1324+
<xsl:if test="$ServiceCategory != ''">
1325+
<geodcatap:serviceCategory rdf:resource="{$ServiceCategory}"/>
1326+
</xsl:if>
13281327
<geodcatap:serviceType rdf:resource="{$SpatialDataServiceTypeCodelistUri}/{$ServiceType}"/>
13291328
</xsl:if>
13301329
<!-- Spatial extent -->
@@ -1344,7 +1343,7 @@
13441343
<dct:provenance>
13451344
<dct:ProvenanceStatement>
13461345
<rdfs:label xml:lang="{$MetadataLanguage}">
1347-
<xsl:value-of select="$Lineage"/>
1346+
<xsl:value-of select="$Lineage"/>
13481347
</rdfs:label>
13491348
</dct:ProvenanceStatement>
13501349
</dct:provenance>
@@ -1397,7 +1396,7 @@
13971396
<xsl:variable name="DistributionFormat">
13981397
<xsl:apply-templates mode="iso19139-to-dcatap" select="gmd:distributionFormat/gmd:MD_Format/gmd:name/*"/>
13991398
</xsl:variable>
1400-
<!-- Resource locators (access / download URLs) -->
1399+
<!-- Resource locators (access / download URLs) -->
14011400
<xsl:for-each select="(gmd:transferOptions | gmd:distributor/gmd:MD_Distributor/gmd:distributorTransferOptions)/*/gmd:onLine/*">
14021401

14031402
<xsl:variable name="DistributorFormat">
@@ -1427,7 +1426,7 @@
14271426
<xsl:variable name="Title">
14281427
<xsl:for-each select="gmd:name">
14291428
<dct:title xml:lang="{$MetadataLanguage}">
1430-
<xsl:value-of select="normalize-space(*)"/>
1429+
<xsl:value-of select="normalize-space(gco:CharacterString)"/>
14311430
</dct:title>
14321431
<xsl:call-template name="LocalisedString">
14331432
<xsl:with-param name="term">dct:title</xsl:with-param>
@@ -3045,7 +3044,6 @@
30453044
<xsl:template mode="iso19139-to-dcatap" name="Keyword" match="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords">
30463045
<xsl:param name="MetadataLanguage"/>
30473046
<xsl:param name="ResourceType"/>
3048-
<xsl:param name="ServiceType"/>
30493047
<xsl:param name="OriginatingControlledVocabularyURI" select="normalize-space(gmd:thesaurusName/gmd:CI_Citation/gmd:title/gmx:Anchor/@xlink:href)"/>
30503048
<xsl:param name="OriginatingControlledVocabulary">
30513049
<!--
@@ -3217,7 +3215,9 @@
32173215

32183216
<!-- Regular dcat:theme -->
32193217
<xsl:otherwise>
3220-
<dcat:theme rdf:resource="{gmx:Anchor/@xlink:href}"/>
3218+
<xsl:if test="not(starts-with(gmx:Anchor/@xlink:href, $SpatialDataServiceCategoryCodelistUri))">
3219+
<dcat:theme rdf:resource="{gmx:Anchor/@xlink:href}"/>
3220+
</xsl:if>
32213221
</xsl:otherwise>
32223222
</xsl:choose>
32233223

@@ -3226,8 +3226,10 @@
32263226
<!-- Mapping added for compliance with DCAT-AP 2 -->
32273227
<xsl:if test="$profile = $extended">
32283228
<!-- DEPRECATED: Mapping kept for backward compatibility with GeoDCAT-AP v1.* -->
3229-
<xsl:if test="$include-deprecated = 'yes'">
3230-
<dct:subject rdf:resource="{gmx:Anchor/@xlink:href}"/>
3229+
<xsl:if test="$include-deprecated = 'yes'">
3230+
<xsl:if test="not(starts-with(gmx:Anchor/@xlink:href, $SpatialDataServiceCategoryCodelistUri))">
3231+
<dct:subject rdf:resource="{gmx:Anchor/@xlink:href}"/>
3232+
</xsl:if>
32313233
</xsl:if>
32323234
</xsl:if>
32333235
</xsl:if>
@@ -3479,8 +3481,7 @@
34793481
<!-- Encoding -->
34803482

34813483
<xsl:template mode="iso19139-to-dcatap" name="Encoding"
3482-
match="gmd:distributionFormat/gmd:MD_Format/gmd:name/*
3483-
|gmd:distributorFormat/gmd:MD_Format/gmd:name/*">
3484+
match="gmd:distributionFormat/gmd:MD_Format/gmd:name/*|gmd:distributorFormat/gmd:MD_Format/gmd:name/*">
34843485
<xsl:param name="format-label">
34853486
<xsl:value-of select="normalize-space(.)"/>
34863487
</xsl:param>

0 commit comments

Comments
 (0)