-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdataciteToISO19139v3.2.xslt
2393 lines (2270 loc) · 135 KB
/
dataciteToISO19139v3.2.xslt
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"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:datetime="http://exslt.org/dates-and-times"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="datetime">
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="yes"/>
<!--
Damian Ulbricht original xslt
Revised by Stephen Richard to generalize handling of more options and update for
DataCite v4 xml. For use by IEDA
This transform takes a datacite v2,3, or 4 xml document and transforms to ISO19139 xml.
uses local-names for elements, so for those elements that are the same in DataCite v3 and v4
will work.
2017-04-04 update to handle related identifiers, pre v4.
spatial location encoding.
Handle relatedIdentifiers (gmd:aggregationInfo)
Put funder information in gmd:identificationInfo/gmd:credit
Add gmd:metadataMaintainence note describing how the ISO record was generated
2017-04-12 translations for MD_Scopecode and the codelists
moved metadata contact to a template since this is always static information
changed fileidentifier to be retrieved from the DOI value
changes for XSLT 1.0 - replaced "exists(x)" with "count(x) > 0" for lists of nodes and replaced "exists(x)" with
" x!='' " for strings
SMR 2017-10-14 update to group keywords by subjectScheme and identifies IEDA facet group keywords and puts them in
properly labeled groups. The standard codeListValues are used, and the IEDA facet nameis the element value
in the MD_KeywordTypeCode element. Also add data center keyword.
SMR 2018-01-25 update to use for any IEDA DataCite.
Have to insert logic to determine partner system source if new partners are added
SMR 2018-03-18 update header comments, change name so datacite is lower case, for consistency
add license and copyright statement.
SMR 2018 ? update to use Available date as date released if it is available, otherwise publication year
SMR 2018-06-19 add input parameter for gmd:dateStamp named 'updateDate'. This should be the most recent update
date for the source record being transformed. Since DataCiteXML doesn't have an element for the
metadata update date, this should be populated from the file-system update date
SMR 2018-06-21 Add tests to make sure that record gets gmd:dateStamp and topicCategory.
dateStamp can be passed as parameter or defaults to now(); topicCategory is pulled from
subjects/subject if there is an ISO value, otherwise defaults to 'geoscientificInformation'
-->
<!-- * @copyright 2007-2017 Interdisciplinary Earth Data Alliance, Columbia University.
All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License -->
<!-- parameter to pass in the gmd:dateStamp for metadata update date -->
<xsl:param name="updateDate"></xsl:param>
<!-- this is used for the Data Centre keyword type for faceting in the search interface (Geoportal) -->
<xsl:variable name="datacentre">
<xsl:choose>
<!-- USAP -->
<xsl:when test="//*[local-name()='alternateIdentifier' and contains(text(),'www.usap-dc.org')]">
<xsl:value-of select="string('US Antarctic Program Data Center (USAP-DC)')"/>
</xsl:when>
<!-- ECL -->
<xsl:when test="//*[local-name()='alternateIdentifier' and contains(text(),'www.earthchem.org')]">
<xsl:value-of select="string('EarthChem Library (ECL)')"/>
</xsl:when>
<!-- Academic Seismic Portal at Lamont -->
<xsl:when test="//*[local-name()='alternateIdentifier' and contains(@alternateIdentifierType,'UTIG')]">
<xsl:value-of select="string('ASP@LDEO')"/>
</xsl:when>
<xsl:when test="string-length(normalize-space(//*[local-name() = 'publisher'][1]))>0 and
normalize-space(//*[local-name() = 'publisher'][1]) != 'missing'">
<xsl:value-of select="normalize-space(//*[local-name() = 'publisher'][1])"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('Interdisciplinary Earth Data Alliance')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- The contact for the metadata - static value; customize for your
application. -->
<xsl:template name="metadatacontact">
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>Interdisciplinary Earth Data Alliance</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<!--<gco:CharacterString>info@EarthChem.org</gco:CharacterString>-->
<gco:CharacterString>
<xsl:choose>
<xsl:when test="$datacentre='US Antarctic Program Data Center (USAP-DC)'">
<xsl:value-of select="string('web@usap-dc.org')"/>
</xsl:when>
<xsl:when test="$datacentre='EarthChem Library (ECL)'">
<xsl:value-of select="string('info@EarthChem.org')"/>
</xsl:when>
<xsl:when test="$datacentre='ASP@LDEO'">
<xsl:value-of select="string('info@marine-geo.org')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('info@iedadata.org')"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<!-- only allow one online resource; choose the logo...
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.earthchem.org/library</gmd:URL>
</gmd:linkage>
<gmd:function>
<gmd:CI_OnLineFunctionCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="information"
>information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onlineResource>-->
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:choose>
<xsl:when test="$datacentre='US Antarctic Program Data Center (USAP-DC)'">
<xsl:value-of select="string('http://www.usap-dc.org/static/imgs/header/usaplogo.png')"/>
</xsl:when>
<xsl:when test="$datacentre='EarthChem Library (ECL)'">
<xsl:value-of select="string('http://www.earthchem.org/sites/earthchem.org/files/arthemia_logo.jpg')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('https://www.iedadata.org/wp-content/themes/IEDA/assets/img/logo.png')"/>
</xsl:otherwise>
</xsl:choose>
</gmd:URL>
</gmd:linkage>
<gmd:function>
<gmd:CI_OnLineFunctionCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="browseGraphic">logo graphic</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</xsl:template>
<!-- SMR20171014 set up key for grouping dataCite Subject element with the same subject scheme -->
<xsl:key name="topic" match="//*[local-name()='subject']" use="@subjectScheme"/>
<!-- define variables for top level elements in DataCite xml to simplify xpaths... -->
<xsl:variable name="datacite-identifier" select="//*[local-name() = 'identifier']"/>
<xsl:variable name="datacite-titles" select="//*[local-name() = 'titles']"/>
<xsl:variable name="datacite-alternateIDs" select="//*[local-name() = 'alternateIdentifiers']"/>
<xsl:variable name="datacite-contributors" select="//*[local-name() = 'contributors']"/>
<xsl:variable name="datacite-creators" select="//*[local-name() = 'creators']"/>
<xsl:variable name="datacite-dates" select="//*[local-name() = 'dates']"/>
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<!-- these variables set content for gmd:metadataMaintenance element at the end of the record
recommend using these to report on how this record was created and by who. -->
<xsl:variable name="metaMaintenanceNote"
select="
string('This metadata record was generated by an xslt transformation from a DataCite metadata record; The transform was created by Damian Ulbricht and Stephen M. Richard. 2017-11-15 these records include new IEDA keywords for geoportal facets')"/>
<xsl:variable name="maintenanceContactID"
select="string('http://orcid.org/0000-0001-6041-5302')"/>
<xsl:variable name="maintenanceContactName" select="string('metadata curator')"/>
<xsl:variable name="maintenanceContactEmail" select="string('maintenance.contact@email.org')"/>
<xsl:variable name="currentDateTime">
<xsl:value-of select="datetime:date-time()"/>
</xsl:variable>
<!-- end of configuration variables -->
<!-- here we go..... -->
<xsl:template match="/">
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml/3.2"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd">
<!-- The fileIdentifier identifies the
metadata record, not the described resource which is identified by a DOI.
-->
<xsl:variable name="fileIdentifierPrefix" select="string('urn:ieda:')"/>
<gmd:fileIdentifier>
<gco:CharacterString>
<xsl:choose>
<xsl:when
test="string-length($datacite-identifier) > 0 and count($datacite-identifier[@identifierType = 'DOI']) > 0">
<xsl:value-of
select="concat($fileIdentifierPrefix, string('metadataabout:'), normalize-space(translate($datacite-identifier, '/:', '--')))"
/>
</xsl:when>
<xsl:when
test="count($datacite-alternateIDs/*[local-name() = 'alternateIdentifier'][@alternateIdentifierType = 'IEDA submission_ID']) > 0">
<xsl:value-of
select="
concat($fileIdentifierPrefix, string('metadataabout:'),
normalize-space(substring-after($datacite-alternateIDs/*[local-name() = 'alternateIdentifier'][@alternateIdentifierType = 'IEDA submission_ID']/text(), 'urn:')))"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="concat($fileIdentifierPrefix, string('metadata:'), normalize-space(translate($datacite-titles/*[local-name() = 'title'][1], '/: ,', '----')))"
/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/"
codeListValue="eng">eng</gmd:LanguageCode>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode
codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_CharacterSetCode"
codeListValue="utf8"/>
</gmd:characterSet>
<!-- dataset is downcase -->
<xsl:variable name="resourcetype">
<xsl:value-of select="//*[local-name() = 'resourceType']/@resourceTypeGeneral"/>
</xsl:variable>
<xsl:variable name="MDScopecode">
<xsl:choose>
<xsl:when test="$resourcetype = 'Dataset'">dataset</xsl:when>
<xsl:when test="$resourcetype = 'Software'">software</xsl:when>
<xsl:when test="$resourcetype = 'Service'">service</xsl:when>
<xsl:when test="$resourcetype = 'Model'">model</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$resourcetype"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MDScopelist">
<xsl:choose>
<xsl:when
test="$resourcetype = 'Dataset' or $resourcetype = 'Software' or $resourcetype = 'Service' or $resourcetype = 'Model'"
>http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode</xsl:when>
<xsl:otherwise>http://datacite.org/schema/kernel-4</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode>
<xsl:attribute name="codeList">
<xsl:value-of select="$MDScopelist"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="$MDScopecode"/>
</xsl:attribute>
<xsl:value-of select="$MDScopecode"/>
</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:hierarchyLevelName>
<gco:CharacterString>
<xsl:value-of select="//*[local-name() = 'resourceType']"/>
</gco:CharacterString>
</gmd:hierarchyLevelName>
<!-- The contact for the metadata - static value assigned in template at the top of this file; -->
<xsl:call-template name="metadatacontact"/>
<gmd:dateStamp>
<xsl:variable name="theDate">
<xsl:choose>
<xsl:when test="$updateDate">
<xsl:value-of select="$updateDate"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$currentDateTime"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$theDate != ''">
<xsl:choose>
<xsl:when test="contains($theDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$theDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($theDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($theDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$theDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- put something in, but flag as bogus -->
<gco:DateTime>
<xsl:value-of select="$currentDateTime"/>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('missing')"/>
</xsl:attribute>
</gco:DateTime>
</xsl:otherwise>
</xsl:choose>
</gmd:dateStamp>
<gmd:metadataStandardName>
<gco:CharacterString>ISO 19139 Geographic Information - Metadata - Implementation Specification</gco:CharacterString>
</gmd:metadataStandardName>
<gmd:metadataStandardVersion>
<gco:CharacterString>2007</gco:CharacterString>
</gmd:metadataStandardVersion>
<!-- DataCite is WGS84; need to verify for IEDA usage-->
<!-- <gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>urn:ogc:def:crs:EPSG:4326</gco:CharacterString>
</gmd:code>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>-->
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:for-each
select="$datacite-titles/*[local-name() = 'title']">
<xsl:choose>
<xsl:when test="not(count(@titleType) > 0)">
<xsl:value-of select="."/>
</xsl:when>
<xsl:when
test="string(@titleType) = 'Subtitle' and . != ''">
<xsl:value-of select="concat('; Subtitle: ', .)"/>
</xsl:when>
<xsl:when
test="string(@titleType) = 'TranslatedTitle' and . != ''">
<xsl:value-of
select="concat('; Translated title: ', .)"/>
</xsl:when>
<xsl:when
test="string(@titleType) = 'Other' and . != ''">
<xsl:value-of select="concat('; Other title: ', .)"
/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</gco:CharacterString>
</gmd:title>
<xsl:for-each select="$datacite-titles/*[local-name() = 'title']">
<xsl:if test="string(@titleType) = 'AlternativeTitle' and . != ''">
<gmd:alternateTitle>
<gco:CharacterString>
<xsl:value-of select="string(.)"/>
</gco:CharacterString>
</gmd:alternateTitle>
</xsl:if>
</xsl:for-each>
<xsl:call-template name="resourcedates"/>
<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:choose>
<xsl:when
test="starts-with($datacite-identifier, 'doi:') or contains($datacite-identifier, 'doi.org')">
<xsl:value-of select="$datacite-identifier"/>
</xsl:when>
<xsl:when
test="count($datacite-identifier[@identifierType = 'DOI']) > 0"
> doi:<xsl:value-of select="$datacite-identifier"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$datacite-identifier"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>
<xsl:call-template name="creators"/>
<xsl:call-template name="contributors"/>
<gmd:citedResponsibleParty>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="organisation">
<xsl:value-of select=".//*[local-name() = 'publisher']"/>
</xsl:with-param>
<xsl:with-param name="role">publisher</xsl:with-param>
</xsl:call-template>
</gmd:citedResponsibleParty>
<!-- some ECL records have long lists of related publications; ideally these would be links thru related resources, but ...
Don't want these to be indexed with abstract, so put them here and check that they show up in the full record display-->
<xsl:if
test="//*[local-name() = 'description'][@descriptionType = 'Other'][contains(., 'Related publications:')]">
<gmd:otherCitationDetails>
<gco:CharacterString>
<xsl:for-each
select="//*[local-name() = 'description'][@descriptionType = 'Other'][contains(., 'Related publications:')]">
<xsl:value-of select="concat(' ', string(.))"/>
</xsl:for-each>
</gco:CharacterString>
</gmd:otherCitationDetails>
</xsl:if>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>
<xsl:for-each select="//*[local-name() = 'description']">
<xsl:choose>
<xsl:when test="@descriptionType = 'Abstract'">
<xsl:value-of select="concat('Abstract: ', string(.))"/>
</xsl:when>
<xsl:when test="@descriptionType = 'SeriesInformation'">
<xsl:text>
</xsl:text>
<xsl:value-of
select="concat('Series Information: ', string(.))"/>
</xsl:when>
<xsl:when test="@descriptionType = 'TableOfContents'">
<xsl:text>
</xsl:text>
<xsl:value-of
select="concat('Table of Contents: ', string(.))"/>
</xsl:when>
<xsl:when test="@descriptionType = 'TechnicalInfo'">
<xsl:text>
</xsl:text>
<xsl:value-of
select="concat('Techical Information: ', string(.))"/>
</xsl:when>
<xsl:when test="@descriptionType = 'Other'">
<xsl:if
test="not(contains(string(.), 'Related publications:'))">
<xsl:text>
</xsl:text>
<xsl:value-of
select="concat('Other Description: ', string(.))"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</gco:CharacterString>
</gmd:abstract>
<xsl:if test="count(//*[local-name() = 'fundingReferences']) > 0">
<xsl:for-each
select="//*[local-name() = 'fundingReferences']/*[local-name() = 'fundingReference']">
<gmd:credit>
<gco:CharacterString>
<xsl:value-of
select="normalize-space(concat(string('funderName:'), string(*[local-name() = 'funderName'])))"/>
<xsl:if
test="count(*[local-name() = 'funderIdentifier']) > 0">
<xsl:text>
</xsl:text>
<xsl:value-of
select="normalize-space(concat(string('funderIdentifier:'), string(*[local-name() = 'funderIdentifier'])))"/>
<xsl:value-of
select="normalize-space(concat(string('; IDType:'), string(*[local-name() = 'funderIdentifier']/@funderIdentifierType)))"
/>
</xsl:if>
<xsl:if test="count(*[local-name() = 'awardNumber']) > 0">
<xsl:text>
</xsl:text>
<xsl:value-of
select="normalize-space(concat(string('awardNumber:'), string(*[local-name() = 'awardNumber'])))"
/>
</xsl:if>
<xsl:if test="count(*[local-name() = 'awardTitle']) > 0">
<xsl:text>
</xsl:text>
<xsl:value-of
select="normalize-space(concat(string('awardTitle:'), string(*[local-name() = 'awardTitle'])))"
/>
</xsl:if>
</gco:CharacterString>
</gmd:credit>
</xsl:for-each>
</xsl:if>
<gmd:status>
<gmd:MD_ProgressCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode"
codeListValue="Complete">Complete</gmd:MD_ProgressCode>
</gmd:status>
<xsl:call-template name="datasetcontact"/>
<xsl:call-template name="versionandformat"/>
<xsl:call-template name="freekeywords"/>
<xsl:call-template name="thesauruskeywords"/>
<xsl:call-template name="geolocationplace"/>
<!-- insert data center keyword; this is configured at the beginning of this xslt -->
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="$datacentre"/>
</gco:CharacterString>
</gmd:keyword>
<gmd:type>
<gmd:MD_KeywordTypeCode
codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode"
codeListValue="dataCentre">Data Center</gmd:MD_KeywordTypeCode>
</gmd:type>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
<xsl:call-template name="license"/>
<xsl:call-template name="relatedResources">
<xsl:with-param name="relres"
select="//*[local-name() = 'relatedIdentifiers']"/>
<!-- pass a set of related identifier nodes -->
</xsl:call-template>
<!-- assume english for now -->
<gmd:language>
<gco:CharacterString>eng</gco:CharacterString>
</gmd:language>
<!-- check namespace to determine what DataCite version we are in;
the spatial coverage encoding is complete different for v.4 -->
<xsl:choose>
<xsl:when test="//*[local-name() = 'subject'][contains('farming, biota, boundaries, climatologyMeteorologyAtmosphere, economy, elevation, environment, geoscientificInformation, health, imageryBaseMapsEarthCover, intelligenceMilitary, inlandWaters, location, oceans, planningCadastre, society, structure, transportation, utilitiesCommunication, ',
concat(normalize-space(string(.)),', '))]">
<xsl:for-each select="//*[local-name() = 'subject']">
<xsl:if
test="string-length(normalize-space(string(.)))>0 and
contains('farming, biota, boundaries, climatologyMeteorologyAtmosphere, economy, elevation, environment, geoscientificInformation, health, imageryBaseMapsEarthCover, intelligenceMilitary, inlandWaters, location, oceans, planningCadastre, society, structure, transportation, utilitiesCommunication, ',
concat(normalize-space(string(.)),', '))">
<!-- accumulate topic elements in hasISOtopic variable -->
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>
<xsl:choose>
<xsl:when test="translate(normalize-space(string(.)),$uppercase,$smallcase)='atmosphere'">
<xsl:value-of select="string('climatologyMeteorologyAtmosphere')"/>
</xsl:when>
<xsl:when test="translate(normalize-space(string(.)),$uppercase,$smallcase)='military'">
<xsl:value-of select="string('intelligenceMilitary')"/>
</xsl:when>
<xsl:when test="translate(normalize-space(string(.)),$uppercase,$smallcase)='cadastre'">
<xsl:value-of select="string('planningCadastre')"/>
</xsl:when>
<xsl:when test="translate(normalize-space(string(.)),$uppercase,$smallcase)='communication'">
<xsl:value-of select="string('utilitiesCommunication')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(string(.))"/>
</xsl:otherwise>
</xsl:choose>
</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<gmd:topicCategory gco:nilReason="missing">
<gmd:MD_TopicCategoryCode>
<xsl:value-of select="string('geoscientificInformation')"/>
</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when
test="string(namespace-uri(//*[local-name() = 'identifier'])) = 'http://datacite.org/schema/kernel-4'">
<xsl:call-template name="spatialcoverage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="spatialcoverage3"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="temporalcoverage"/>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<xsl:call-template name="size"/>
<xsl:if
test="
starts-with($datacite-identifier, 'doi:') or
$datacite-identifier/@identifierType = 'DOI' or
starts-with($datacite-identifier, 'http://')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:choose>
<xsl:when
test="starts-with($datacite-identifier, 'doi:')">
<xsl:value-of
select="concat('http://dx.doi.org/', substring-after($datacite-identifier, 'doi:'))"
/>
</xsl:when>
<xsl:when
test="$datacite-identifier/@identifierType = 'DOI'">
<xsl:value-of
select="concat('http://dx.doi.org/', normalize-space($datacite-identifier))"
/>
</xsl:when>
<xsl:when
test="starts-with($datacite-identifier, 'http://')">
<xsl:value-of select="$datacite-identifier"/>
</xsl:when>
</xsl:choose>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>Landing Page</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string('Link to DOI landing page or
data facility landing page if no DOI is
assigned.'))" />
</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="information"
>information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
<xsl:for-each
select="//*[local-name() = 'alternateIdentifier'] ">
<xsl:if test=". != '' and starts-with(normalize-space(string(.)), 'http')">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="string(.)"/>
</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>
<xsl:value-of select="normalize-space(string(@alternateIdentifierType))"/>
</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>Link to a web page related to the resource.</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"
codeListValue="information"
>information</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:if>
</xsl:for-each>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<!-- put method descripiton in the lineage statement -->
<xsl:if
test="//*[local-name() = 'description' and @descriptionType = 'Methods' and normalize-space() != '']">
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope gco:nilReason="missing"/>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>
<xsl:value-of
select="//*[local-name() = 'description' and @descriptionType = 'Methods']"
/>
</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</xsl:if>
<gmd:metadataMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency gco:nilReason="unknown"/>
<gmd:maintenanceNote>
<gco:CharacterString>
<xsl:value-of
select="concat(string($metaMaintenanceNote), string(' Run on '), string($currentDateTime))"
/>
</gco:CharacterString>
</gmd:maintenanceNote>
<gmd:contact>
<xsl:if test="$maintenanceContactID != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$maintenanceContactID"/>
</xsl:attribute>
</xsl:if>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactName"/>
</gco:CharacterString>
</gmd:individualName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>
<xsl:value-of select="$maintenanceContactEmail"/>
</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="processor">processor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
</gmd:MD_MaintenanceInformation>
</gmd:metadataMaintenance>
</gmd:MD_Metadata>
</xsl:template>
<!-- retrieves basic reference dates of the resource
Handles created date, publication (Available) date, and revision date-->
<xsl:template name="resourcedates">
<xsl:if test="$datacite-dates/*[local-name() = 'date' and @dateType = 'Created'] != ''">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="theDate"
select="normalize-space($datacite-dates/*[local-name() = 'date' and @dateType = 'Created'][1])"/>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$theDate != ''">
<xsl:choose>
<xsl:when test="contains($theDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$theDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($theDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($theDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$theDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
<xsl:choose>
<!-- Take 'Available' date first because that is YYYY-MM-DD -->
<xsl:when test="$datacite-dates/*[local-name() = 'date' and @dateType = 'Available'] != ''">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>
<xsl:value-of select="$datacite-dates/*[local-name() = 'date' and @dateType = 'Available'] "/>
</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:when test="string-length(//*[local-name() = 'publicationYear'])>0">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>
<xsl:value-of select="string(//*[local-name() = 'publicationYear'])"/>
</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
codeListValue="publication">publication</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:when>
<xsl:otherwise>
<gmd:date gco:nilReason="missing"/>
</xsl:otherwise>
</xsl:choose>
<!-- the following test is designed to filter out update-metadata dates if these follow the convention
that metadata update date strings are prefixed with 'metadata'-->
<xsl:if
test="
($datacite-dates/*[local-name() = 'date' and @dateType = 'Updated'][1] != '')
and not(starts-with($datacite-dates/*[local-name() = 'date' and @dateType = 'Updated'][1], 'metadata'))">
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<xsl:variable name="theDate"
select="normalize-space($datacite-dates/*[local-name() = 'date' and @dateType = 'Updated'][1])"/>
<!-- ieda dataCite labels metadata update date in the date string to avoid ambiguity -->
<xsl:choose>
<xsl:when test="$theDate != ''">
<xsl:choose>
<xsl:when test="contains($theDate, 'T')">
<gco:DateTime>
<xsl:value-of select="$theDate"/>
</gco:DateTime>
</xsl:when>
<xsl:when test="contains($theDate, ' ')">
<gco:DateTime>
<xsl:value-of select="translate($theDate, ' ', 'T')"/>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:value-of select="$theDate"/>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="string('missing')"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</xsl:if>
</xsl:template>
<!-- convert datacite authors -->
<xsl:template name="creators">
<xsl:variable name="datacite-creators" select="//*[local-name() = 'creators']"/>
<xsl:for-each select="$datacite-creators/*[local-name() = 'creator']">
<gmd:citedResponsibleParty>
<xsl:variable name="httpuri">
<xsl:call-template name="gethttpuri">
<xsl:with-param name="theids" select="*[local-name() = 'nameIdentifier']"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="nameidscheme">
<xsl:call-template name="getidscheme">
<xsl:with-param name="httpuri" select="$httpuri"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$httpuri != ''">
<xsl:attribute name="xlink:href">
<xsl:value-of select="$httpuri"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="email">
<xsl:choose>
<xsl:when
test="*[local-name() = 'nameIdentifier' and (@nameIdentifierScheme = 'e-mail address')] != ''">
<xsl:choose>
<xsl:when
test="starts-with(*[local-name() = 'nameIdentifier' and (@nameIdentifierScheme = 'e-mail address')], 'mailto')">
<xsl:value-of
select="substring-after(*[local-name() = 'nameIdentifier' and (@nameIdentifierScheme = 'e-mail address')], 'mailto:')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="string(*[local-name() = 'nameIdentifier' and (@nameIdentifierScheme = 'e-mail address')])"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="namestring">
<xsl:choose>
<xsl:when test="normalize-space(*[local-name() = 'familyName']) != ''">
<xsl:value-of
select="
concat(normalize-space(*[local-name() = 'familyName']),
', ', normalize-space(*[local-name() = 'givenName']))"
/>
</xsl:when>
<xsl:when test="normalize-space(*[local-name() = 'creatorName']) != ''">
<xsl:value-of select="normalize-space(*[local-name() = 'creatorName'])"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('missing')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="ci_responsibleparty">
<xsl:with-param name="individual">
<xsl:value-of select="$namestring"/>
</xsl:with-param>
<xsl:with-param name="httpuri">
<xsl:value-of select="$httpuri"/>
</xsl:with-param>
<xsl:with-param name="personidtype">
<xsl:value-of select="$nameidscheme"/>
</xsl:with-param>
<xsl:with-param name="organisation">
<xsl:value-of select=".//*[local-name() = 'affiliation']"/>
</xsl:with-param>
<xsl:with-param name="position"/>
<xsl:with-param name="role">author</xsl:with-param>
<xsl:with-param name="email">
<xsl:value-of select="$email"/>
</xsl:with-param>