-
Notifications
You must be signed in to change notification settings - Fork 1
/
ogcCSW-toUSGIN_ISO19139.xslt
992 lines (989 loc) · 41.7 KB
/
ogcCSW-toUSGIN_ISO19139.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ows="http://www.opengis.net/ows" xmlns:ows11="http://www.opengis.net/ows/1.1"
xmlns:gml="http://www.opengis.net/gml" xmlns:csw="http://www.opengis.net/cat/csw"
xmlns:csw202="http://www.opengis.net/cat/csw/2.0.2" xmlns:wcs="http://www.opengis.net/wcs"
xmlns:wcs11="http://www.opengis.net/wcs/1.1" xmlns:wcs111="http://www.opengis.net/wcs/1.1.1"
xmlns:wfs="http://www.opengis.net/wfs" xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:wms="http://www.opengis.net/wms" xmlns:wps100="http://www.opengis.net/wps/1.0.0"
xmlns:sos10="http://www.opengis.net/sos/1.0" xmlns:sps="http://www.opengis.net/sps"
xmlns:tml="http://www.opengis.net/tml" xmlns:sml="http://www.opengis.net/sensorML/1.0.1"
xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:myorg="http://www.myorg.org/features"
xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:exslt="http://exslt.org/common">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="sourceUrl"/>
<xsl:param name="serviceType"/>
<xsl:param name="currentDate"/>
<xsl:param name="generatedUUID"/>
<!-- *********** -->
<!-- This style sheet converts OGC CSW capabilities response document (versions 2.0.0, 2.0.1 or 2.0.2 to
ISO (19115(2006), 19119, 19139 metadata that conforms with the USGIN metadata profile.
See http://lab.usgin.org/profiles/usgin-iso-metadata-profile (http://lab.usgin.org/node/235) -->
<!-- Stephen M Richard, steve.richard@azgs.az.gov -->
<!-- provided as-is, use at your own risk! -->
<!-- this program based on ogc-toISO19139.xslt provided with ESRI geoportal software package
and USGIN service metadata example xml document -->
<!-- version 1.0 2010-12-27 -->
<xsl:template match="/">
<xsl:call-template name="main"/>
</xsl:template>
<xsl:template name="main">
<!-- Core gmd based instance document -->
<xsl:variable name="cDate">
<xsl:choose>
<xsl:when test="string-length($currentDate) = 0">
<xsl:value-of select="concat('1900', '-', '01', '-', '01')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$currentDate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<gmd:MD_Metadata xmlns="http://www.isotc211.org/2005/gmd"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:srv="http://www.isotc211.org/2005/srv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd
http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd"
xsl:exclude-result-prefixes="ows ows11 wms wps100 swe myorg tml sml sps sos10 wfs wcs wcs11 wcs111 csw csw202 gml">
<!-- (M-M) Metadata file identifier - A unique File Identifier (GUID)
- USGIN recommends using a valid Universally Unique Identifier (UUID) -->
<gmd:fileIdentifier>
<gco:CharacterString>
<xsl:value-of select="$generatedUUID"/>
</gco:CharacterString>
</gmd:fileIdentifier>
<!-- language -->
<xsl:choose>
<xsl:when test="//ows:Language | //Language">
<gmd:language>
<gco:CharacterString>
<xsl:value-of select="text()"/>
</gco:CharacterString>
</gmd:language>
</xsl:when>
<xsl:otherwise>
<gmd:language>
<gco:CharacterString>eng</gco:CharacterString>
</gmd:language>
</xsl:otherwise>
</xsl:choose>
<!-- (M-M) Metadata character set - default is "utf8", codelist = MD_CharacterSetCode.
USGIN requires that a character set code is defined to facilitate CSW servers
(deegree, GeoNetwork, etc.). -->
<gmd:characterSet>
<gmd:MD_CharacterSetCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode"
codeListValue="utf8">UTF-8</gmd:MD_CharacterSetCode>
</gmd:characterSet>
<!-- (M-M) Resource type - this is specific to WMS, so define as service -->
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode"
codeListValue="service">service</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<!-- (O-M) Resource hierarchy level name - For services USGIN hierarchyLevelName.CharacterString
is “Service”. -->
<gmd:hierarchyLevelName>
<gco:CharacterString>Service</gco:CharacterString>
</gmd:hierarchyLevelName>
<!-- (M-M) Metadata point of contact - Point of contact for the metadata
record, e.g. for users to report errors, updates to metadata, etc. This will
default to the harvesting agent for USGIN purposes, so define with USGIN
contact information -->
<gmd:contact>
<gmd:CI_ResponsibleParty>
<!-- (M-M) (individualName + organisationName + positionName) > 0 -->
<gmd:organisationName>
<gco:CharacterString>US Geoscience Information Network, Arizona Geological
Survey</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Metadata Editor</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<!-- Phone -->
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>520.770.3500</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<!-- Address -->
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>416 W. Congress St., Suite
100</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>Tucson</gco:CharacterString>
</gmd:city>
<gmd:administrativeArea>
<gco:CharacterString>Arizona</gco:CharacterString>
</gmd:administrativeArea>
<gmd:postalCode>
<gco:CharacterString>85701-1381</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>USA</gco:CharacterString>
</gmd:country>
<!-- (O-M) Metadata point of contact e-mail address - mandatory
in USGIN -->
<gmd:electronicMailAddress>
<gco:CharacterString>metadata@azgs.az.gov</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<!-- (O-O) online resources - this is the online resource to contact
the metadata person -->
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.azgs.az.gov</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>http</gco:CharacterString>
</gmd:protocol>
<gmd:description>
<gco:CharacterString>Arizona Geological Survey Web
Site</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
<!-- (O-O) hours of service -->
<gmd:hoursOfService>
<gco:CharacterString>8 AM to 5 PM Mountain Standard time (no
daylight savings)</gco:CharacterString>
</gmd:hoursOfService>
<!-- (O-O) contact instructions -->
<gmd:contactInstructions>
<gco:CharacterString>Fill out contact form at http://www.azgs.az.gov
</gco:CharacterString>
</gmd:contactInstructions>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- (M-M) ISO 19139 Mandatory: contact role -->
<gmd:role>
<!-- CI_RoleCode names: {resourceProvider, custodian, owner, user,
distributor, originator, pointOfContact, principalInvestigator, processor,
publisher, author} - NAP expands with {collaborator, editor, mediator, rightsHolder}. -->
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="pointOfContact">point of contact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<!-- (X-O) Metadata should include a URL that locates a thumbnail logo
for organizations related to the metadata origination, the organization hosting
the catalog that returned the metadata, the organization that originated
the data, and the organization hosting online services that provide access
to the data. -->
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:organisationName>
<gco:CharacterString>Arizona Geological Survey </gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<!-- Icon image file (e.g. tif, png, jpg) for the metadata originator.
This Icon will be displayed in search results to credit the metadata originator. -->
<gmd:linkage>
<gmd:URL>http://resources.usgin.org/uri-gin/usgin/organization/azgs/logo/50x50.png
</gmd:URL>
</gmd:linkage>
<!-- (X-C) For URL’s that indicate icon thumbnails, the CI_OnlineResource/name
should be ‘icon’. -->
<gmd:name>
<gco:CharacterString>icon</gco:CharacterString>
</gmd:name>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<!-- CI_RoleCode names: {resourceProvider, custodian, owner, user,
distributor, originator, pointOfContact, principalInvestigator, processor,
publisher, author} - NAP expands with {collaborator, editor, mediator, rightsHolder}. -->
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="originator">originator</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<!-- (M-M) Metadata date stamp - USGIN profile requires use of dateStamp/gco:DateTime
(Note this contrasts with INSPIRE mandate to use dateStamp/gco:Date). This
is the date and time when the metadata record was created or updated (following
NAP). -->
<gmd:dateStamp>
<gco:DateTime>
<xsl:value-of select="concat($cDate, 'T12:00:00')"/>
</gco:DateTime>
</gmd:dateStamp>
<!-- (M-M) metadata standard - NAP specifies "NAP - Metadata". USGIN profile
conformant metadata is indicated by using “ISO-NAP-USGIN" -->
<gmd:metadataStandardName>
<gco:CharacterString>ISO-NAP-USGIN</gco:CharacterString>
</gmd:metadataStandardName>
<!-- (O-M) USGIN profile version -->
<gmd:metadataStandardVersion>
<gco:CharacterString>1.1</gco:CharacterString>
</gmd:metadataStandardVersion>
<!-- (O-O) Resource’s spatial reference system -->
<!-- none for CSW -->
<referenceSystemInfo>
<MD_ReferenceSystem>
<referenceSystemIdentifier>
<RS_Identifier>
<code>
<gco:CharacterString>urn:ogc:def:nil:OGC:1.0:inapplicable</gco:CharacterString>
</code>
<codeSpace>
<gco:CharacterString>urn:ogc:def:nil:OGC:1.0:inapplicable</gco:CharacterString>
</codeSpace>
</RS_Identifier>
</referenceSystemIdentifier>
</MD_ReferenceSystem>
</referenceSystemInfo>
<!-- -->
<!-- -->
<gmd:identificationInfo>
<srv:SV_ServiceIdentification>
<citation>
<CI_Citation>
<title>
<xsl:choose>
<xsl:when
test="string-length(//ows:ServiceIdentification/ows:Title) > 0 or string-length(//ows11:ServiceIdentification/ows11:Title) > 0">
<gco:CharacterString>
<xsl:value-of
select="
//ows:ServiceIdentification/ows:Title |
//ows11:ServiceIdentification/ows11:Title"
/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<gco:CharacterString>
<xsl:value-of
select="concat('CSW catalog service hosted at ', $sourceUrl)"
/>
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</title>
<date>
<CI_Date>
<date gco:nilReason="notApplicable">
<gco:Date>
<xsl:value-of select="$cDate"/>
</gco:Date>
</date>
<dateType>
<CI_DateTypeCode
codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
codeListValue="publication"/>
</dateType>
</CI_Date>
</date>
<!-- (C-O) Unique resource identifier - For USGIN, because the Citation
is for the service, this identifier should be identical to MD_Metadata/dataSetURI,
and is therefore optional. For USGIN purposes, this element content value
is only an identifier for the citation; it is not a URL for accessing the
service -->
<!-- <gmd:identifier/> -->
<!-- (M-M) Resource responsible party - The citation attribute provides
information for citing the described service. -->
<!--use to test if there is any contact information -->
<xsl:variable name="hasContactInfo"
select="//ows:ServiceContact//text()"/>
<xsl:choose>
<xsl:when test="//ows:ServiceProvider">
<gmd:citedResponsibleParty>
<gmd:CI_ResponsibleParty>
<!-- (M-M) (individualName + organisationName + positionName)
> 0 -->
<xsl:if test="string-length(//ows:IndividualName) > 0">
<gmd:individualName>
<gco:CharacterString>
<xsl:value-of select="/ows:IndividuatlName"/>
</gco:CharacterString>
</gmd:individualName>
</xsl:if>
<!-- provider name is required if an ows:ServiceProvider element is included, but the element may be empty... -->
<gmd:organisationName>
<gco:CharacterString>
<xsl:choose>
<xsl:when
test="string-length(//ows:ProviderName) > 0">
<xsl:value-of select="//ows:ProviderName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Missing'"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:organisationName>
<xsl:if test="string-length(//ows:PositionName) > 0">
<gmd:positionName>
<gco:CharacterString>
<xsl:value-of select="//ows:PositionName"/>
</gco:CharacterString>
</gmd:positionName>
</xsl:if>
<!-- (O-C) Contact Information - (phone + deliveryPoint + electronicMailAddress
) > 0. Best practice is to include at least an e-mail address -->
<gmd:contactInfo>
<gmd:CI_Contact>
<xsl:if test="//ows:Phone//text()">
<gmd:phone>
<gmd:CI_Telephone>
<xsl:if test="string-length(//ows:Voice) > 0">
<gmd:voice>
<gco:CharacterString>
<xsl:value-of select="//ows:Voice"/>
</gco:CharacterString>
</gmd:voice>
</xsl:if>
<xsl:if test="string-length(//ows:Facsimile) > 0">
<gmd:facsimile>
<gco:CharacterString>
<xsl:value-of select="//ows:Facsimile"/>
</gco:CharacterString>
</gmd:facsimile>
</xsl:if>
</gmd:CI_Telephone>
</gmd:phone>
</xsl:if>
<!-- *******************resource contact address*************** -->
<!-- include address element, so meet USGIN requirement at minimum with an e-mail address -->
<gmd:address>
<gmd:CI_Address>
<xsl:if
test="string-length(//ows:Address/ows:DeliveryPoint) > 0">
<gmd:deliveryPoint>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:DeliveryPoint"/>
</gco:CharacterString>
</gmd:deliveryPoint>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:City) > 0">
<gmd:city>
<gco:CharacterString>
<xsl:value-of select="//ows:Address/ows:City"/>
</gco:CharacterString>
</gmd:city>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:AdministrativeArea) > 0">
<gmd:administrativeArea>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:AdministrativeArea"/>
</gco:CharacterString>
</gmd:administrativeArea>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:PostalCode) > 0">
<gmd:postalCode>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:PostalCode"/>
</gco:CharacterString>
</gmd:postalCode>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:Country) > 0">
<gmd:country>
<gco:CharacterString>
<xsl:value-of select="//ows:Address/ows:Country"/>
</gco:CharacterString>
</gmd:country>
</xsl:if>
<!-- test if have e-mail -->
<gmd:electronicMailAddress>
<xsl:choose>
<xsl:when
test="string-length(//ows:Address/ows:ElectronicMailAddress) > 0">
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:ElectronicMailAddress"/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<!-- at least an e-mail address is required -->
<gco:CharacterString>metadata@usgin.org
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- (M-M) ISO 19139 Mandatory: contact role - Guidance on use
of role codes would be helpful for consistency, but has not been developed
as yet. -->
<gmd:role>
<!-- CI_RoleCode names: {resourceProvider, custodian, owner,
user, distributor, originator, pointOfContact, principalInvestigator, processor,
publisher, author} - NAP expands with {collaborator, editor, mediator, rightsHolder}. -->
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="resourceProvider">resource
provider</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:citedResponsibleParty>
</xsl:when>
<xsl:otherwise>
<!-- these are required for conformance with USGIN profile -->
<gmd:citedResponsibleParty gco:nilReason="missing">
<gmd:CI_ResponsibleParty>
<gmd:individualName gco:nilReason="missing">
<gco:CharacterString>not
reported</gco:CharacterString>
</gmd:individualName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone gco:nilReason="missing"/>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>metadata@usgin.org</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="resourceProvider">resource
provider</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:citedResponsibleParty>
</xsl:otherwise>
</xsl:choose>
</CI_Citation>
</citation>
<gmd:abstract>
<xsl:choose>
<xsl:when test="string-length(//ServiceIdentification/Abstract) > 0">
<xsl:variable name="theAbstract"
select="//ServiceIdentification/Abstract"/>
<gco:CharacterString>
<xsl:value-of
select="concat($theAbstract, '. [This metadata was harvested from service GetCapabilities response by USGIN GeoPortal catalog.]')"
/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<gco:CharacterString>OGC CSW service, this metadata harvested from
service capabilities. No abstract provided by service.
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</gmd:abstract>
<!-- <gmd:status/> -->
<gmd:status>
<!-- MD_ProgressCode names: {completed, historicalArchive, obsolete, onGoing, planned, required, underDevelopment} - NAP expands with {proposed}. Obsolete is synonymous with deprecated. -->
<gmd:MD_ProgressCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ProgressCode"
codeListValue="onGoing">onGoing</gmd:MD_ProgressCode>
</gmd:status>
<!-- status not specified in CSW capabiltities; ideally would hame some knowledge about maintenance... -->
<!-- (O-C) Resource service point of contact (access contact) - CI_ResponsibleParty
element here would contain information for point of contact to access the
resource. OGC capabilities only provide one contact element, so this is used
for both the service identification Citation responsible party and the service
point of contact. -->
<xsl:choose>
<xsl:when test="//ows:ServiceProvider">
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<!-- (M-M) (individualName + organisationName + positionName)
> 0 -->
<gmd:individualName>
<gco:CharacterString>
<xsl:choose>
<xsl:when
test="string-length(//ows:IndividualName) > 0">
<xsl:value-of select="//ows:IndividualName"/>
</xsl:when>
<xsl:otherwise>urn:ogc:def:nil:OGC:1.0:missing</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:individualName>
<!-- provider name is required if an ows:ServiceProvider element is included, but the element may be empty... -->
<gmd:organisationName>
<gco:CharacterString>
<xsl:choose>
<xsl:when
test="string-length(//ows:ProviderName) > 0">
<xsl:value-of select="//ows:ProviderName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'missing'"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:organisationName>
<xsl:if test="string-length(//ows:PositionName) > 0">
<gmd:positionName>
<gco:CharacterString>
<xsl:value-of select="//ows:PositionName"/>
</gco:CharacterString>
</gmd:positionName>
</xsl:if>
<!-- (O-C) Contact Information - (phone + deliveryPoint + electronicMailAddress
) > 0. Best practice is to include at least an e-mail address -->
<gmd:contactInfo>
<gmd:CI_Contact>
<xsl:if test="//ows:Phone//text()">
<gmd:phone>
<gmd:CI_Telephone>
<xsl:if test="string-length(//ows:Voice) > 0">
<gmd:voice>
<gco:CharacterString>
<xsl:value-of select="//ows:Voice"/>
</gco:CharacterString>
</gmd:voice>
</xsl:if>
<xsl:if test="string-length(//ows:Facsimile) > 0">
<gmd:facsimile>
<gco:CharacterString>
<xsl:value-of select="//ows:Facsimile"/>
</gco:CharacterString>
</gmd:facsimile>
</xsl:if>
</gmd:CI_Telephone>
</gmd:phone>
</xsl:if>
<!-- *******************resource contact address*************** -->
<!-- include address element, so meet USGIN requirement at minimum with an e-mail address -->
<gmd:address>
<gmd:CI_Address>
<xsl:if
test="string-length(//ows:Address/ows:DeliveryPoint) > 0">
<gmd:deliveryPoint>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:DeliveryPoint"/>
</gco:CharacterString>
</gmd:deliveryPoint>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:City) > 0">
<gmd:city>
<gco:CharacterString>
<xsl:value-of select="//ows:Address/ows:City"/>
</gco:CharacterString>
</gmd:city>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:AdministrativeArea) > 0">
<gmd:administrativeArea>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:AdministrativeArea"/>
</gco:CharacterString>
</gmd:administrativeArea>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:PostalCode) > 0">
<gmd:postalCode>
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:PostalCode"/>
</gco:CharacterString>
</gmd:postalCode>
</xsl:if>
<xsl:if
test="string-length(//ows:Address/ows:Country) > 0">
<gmd:country>
<gco:CharacterString>
<xsl:value-of select="//ows:Address/ows:Country"/>
</gco:CharacterString>
</gmd:country>
</xsl:if>
<!-- test if have e-mail -->
<gmd:electronicMailAddress>
<xsl:choose>
<xsl:when
test="string-length(//ows:Address/ows:ElectronicMailAddress) > 0">
<gco:CharacterString>
<xsl:value-of
select="//ows:Address/ows:ElectronicMailAddress"/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<!-- at least an e-mail address is required -->
<gco:CharacterString>metadata@usgin.org
</gco:CharacterString>
</xsl:otherwise>
</xsl:choose>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<!-- (M-M) ISO 19139 Mandatory: contact role - Guidance on use
of role codes would be helpful for consistency, but has not been developed
as yet. -->
<gmd:role>
<!-- CI_RoleCode names: {resourceProvider, custodian, owner,
user, distributor, originator, pointOfContact, principalInvestigator, processor,
publisher, author} - NAP expands with {collaborator, editor, mediator, rightsHolder}. -->
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="pointOfContact">point of
contact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:when>
<xsl:otherwise>
<!-- these are required for conformance with USGIN profile -->
<gmd:pointOfContact gco:nilReason="missing">
<gmd:CI_ResponsibleParty>
<gmd:individualName gco:nilReason="missing">
<gco:CharacterString>not reported</gco:CharacterString>
</gmd:individualName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone gco:nilReason="missing"/>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>metadata@usgin.org</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
codeListValue="pointOfContact">point of
contact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
</xsl:otherwise>
</xsl:choose>
<!-- (O-O) Resource Maintenance - This element provides information
about the maintenance schedule or history of the service described by the
metadata record. For a service, only one MD_MaintenanceInformation elements
may be included; for which the MD_ScopeDescription will be ‘service’. If
MD_MaintenanceInformation is present, then maintenanceAndUpdateFrequency
is mandatory. -->
<!-- <gmd:resourceMaintenance/> -->
<!-- (O-O) Graphic overview of resource - Highly recommended to include
a small image visual representation of the resource provided by a map or
image service. For geographic feature or data services, a graphic overview
might show the geographic distribution of available data. If MD_BrowseGraphic
is included, MD_BrowseGraphic/filename character string is mandatory. USGIN
Recommended practice is to provide a complete URL as a gco:characterString
value for the filename property. -->
<!-- <gmd:graphicOverview/> -->
<!-- (O-X) Resource Format - This element is not used by USGIN; this
information is encoded in MD_Metadata/distributionInfo/MD_Distribution/ in
USGIN metadata. -->
<!-- <gmd:resourceFormat> -->
<!-- (O-O) Resource keywords - Best Practice for USGIN profile metadata
is to supply keywords to facilitate the discovery of metadata records relevant
to the user. USGIN requires that MD_Keyword/keyword contain a CharacterString.
USGIN best practice is to include keywords in English -->
<!-- keywords -->
<xsl:for-each select="//ows:Keywords">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>CSW</gco:CharacterString>
</gmd:keyword>
<gmd:keyword>
<gco:CharacterString>Catalog Service</gco:CharacterString>
</gmd:keyword>
<!-- tokenize doesn't work in xslt v1 -->
<!-- <xsl:for-each select="tokenize(//Keywords, '\s+')">
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="." />
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each> -->
<xsl:for-each
select="//ows:Keyword[not(. = following::ows:Keyword)]">
<gmd:keyword>
<gco:CharacterString>
<xsl:value-of select="."/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<!-- Keyword Type - allowed values from MD_KeywordTypeCode names:
{discipline, place, stratum, temporal, theme} -->
<!-- CSW capabiltities include a keyword type with a codespace, but no standard codespace is specified.-->
<xsl:if test="string-length(./ows:Type) > 0">
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:choose>
<xsl:when
test="string-length(/ows:Type/@codeSpace) > 0">
<xsl:attribute name="codeList">
<xsl:value-of select="./ows:Type/@codeSpace"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="./ows:Type"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="codeList"
>http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:value-of select="./ows:Type"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="./ows:Type"/>
</gmd:MD_KeywordTypeCode>
</gmd:type>
</xsl:if>
<!-- although OGC capabilities allow a vocabulary attribute that broadly
corresponds to a Thesaurus name, its too much of a pain to fool around -->
<!-- extracting, especially since I don't see it used very often -->
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each>
<!-- (O-X) Resource specific usage - Property not USED by USGIN. -->
<!-- <gmd:resourceSpecificUsage/> -->
<!-- -->
<!-- (O-O) Condition applying to access and use of resource - Restrictions
on the access and use of a service. -->
<gmd:resourceConstraints>
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>
<xsl:choose>
<xsl:when test="string-length(//ows:AccessConstraints) > 0">
<xsl:value-of select="//ows:AccessConstraints"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'none specified'"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<!-- (M-M) Service type - Choose a service type name from a registry
of services. USGIN mandates use of a LocalName value from the service type
listing in the ServiceType section of the USGIN ISO19139 profile document,
with the codespace http://resources.usgin.org/uri-gin/usgin/vocabulary/serviceType -->
<srv:serviceType>
<!-- Valid values for OGC services would be then {<WMS, WFS, WVS, CSW,
…} -->
<gco:LocalName
codeSpace="http://resources.usgin.org/uri-gin/usgin/vocabulary/serviceType"
>CSW</gco:LocalName>
</srv:serviceType>
<!-- (O-C) Resource service type version - Multiple serviceTypeVersion
tags may not be implemented in applications. USGIN recommends a reverse chronological
order for supported versions. Constraint: if various versions are available,
mandatory to list versions that are supported. Default is oldest version
of service. -->
<srv:serviceTypeVersion>
<gco:CharacterString>
<xsl:value-of select="//ows:ServiceTypeVersion"/>
</gco:CharacterString>
</srv:serviceTypeVersion>
<srv:extent>
<!-- not specified in capabilities; default to world -->
<EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-180</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>180</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-90</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>90</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</EX_Extent>
</srv:extent>
<srv:couplingType>
<srv:SV_CouplingType codeList="#SV_CouplingType" codeListValue="tight"
>tight</srv:SV_CouplingType>
</srv:couplingType>
<srv:containsOperations>
<xsl:choose>
<xsl:when
test="
//ows:Operation[@name = 'GetCapabilities']/ows:DCP/ows:HTTP/ows:Get/@xlink:href |
//ows:Operation[@name = 'GetCapabilities']/ows:DCP/ows:HTTP/ows:Post/@xlink:href |
//ows11:Operation[@name = 'GetCapabilities']/ows11:DCP/ows11:HTTP/ows11:Get/@xlink:href |
//ows11:Operation[@name = 'GetCapabilities']/ows11:DCP/ows11:HTTP/ows11:Post/@xlink:href">
<srv:SV_OperationMetadata>
<srv:operationName>
<gco:CharacterString>GetCapabilities</gco:CharacterString>
</srv:operationName>
<srv:DCP>
<srv:DCPList codeList="#DCPList" codeListValue="WebServices"
>WebServices</srv:DCPList>
</srv:DCP>
<srv:connectPoint>
<CI_OnlineResource>
<linkage>
<URL>
<xsl:value-of
select="
//ows:Operation[@name = 'GetCapabilities']/ows:DCP/ows:HTTP/ows:Get/@xlink:href |
//ows:Operation[@name = 'GetCapabilities']/ows:DCP/ows:HTTP/ows:Post/@xlink:href |
//ows11:Operation[@name = 'GetCapabilities']/ows11:DCP/ows11:HTTP/ows11:Get/@xlink:href |
//ows11:Operation[@name = 'GetCapabilities']/ows11:DCP/ows11:HTTP/ows11:Post/@xlink:href"
/>
</URL>
</linkage>
</CI_OnlineResource>
</srv:connectPoint>
</srv:SV_OperationMetadata>
</xsl:when>
<xsl:otherwise>
<srv:SV_OperationMetadata>
<srv:operationName>
<gco:CharacterString>GetCapabilities</gco:CharacterString>
</srv:operationName>
<srv:DCP>
<srv:DCPList codeList="#DCPList" codeListValue="WebServices"
>WebServices</srv:DCPList>
</srv:DCP>
<srv:connectPoint>
<CI_OnlineResource>
<linkage>
<URL>
<xsl:value-of select="$sourceUrl"/>
</URL>
</linkage>
</CI_OnlineResource>
</srv:connectPoint>
</srv:SV_OperationMetadata>
</xsl:otherwise>
</xsl:choose>
</srv:containsOperations>
</srv:SV_ServiceIdentification>
</gmd:identificationInfo>
<distributionInfo>
<MD_Distribution>
<!-- distribution format -->
<xsl:for-each
select="//ows:OperationsMetadata//ows:Operation[@name = 'GetRecords']//ows:Parameter[@name = 'outputFormat']//ows:Value">
<distributionFormat>
<MD_Format>
<name>
<gco:CharacterString>
<xsl:value-of select="text()"/>
</gco:CharacterString>
</name>
<version gco:nilReason="inapplicable"/>
</MD_Format>
</distributionFormat>
</xsl:for-each>
<!-- USGIN asks for online linkage info in distribution digital transfer options -->
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<!-- (M-M) Resource distributor on-line distribution linkage - Digital transfer options are “technical means and media by which a dataset is obtained from the distributor." . -->
<gmd:linkage>
<!-- This linkage element contains the complete URL to access the getCapabilities document directly.
Since the metadata is harvested from a capabiltities doc, the source URL should work fine...-->
<gmd:URL>
<xsl:value-of select="$sourceUrl"/>
</gmd:URL>
</gmd:linkage>
<!-- The protocol element defines a valid internet protocol used to access the resource. NAP recommended best practice is that the protocol should be taken from an official controlled list such as the Official Internet Protocol Standards published on the Web at http://www.rfc-editor.org/rfcxx00.html or the Internet Assigned Numbers Authority (IANA) at http://www.iana.org/numbers.html. ‘ftp’ or ‘http’ are common values. -->
<gmd:protocol>
<gco:CharacterString>http</gco:CharacterString>
</gmd:protocol>
<!-- Linkage names for service URL’s are from "Linkage name conventions" section in the USGIN ISO19139 profile document. -->
<gmd:name>
<gco:CharacterString>serviceDescription</gco:CharacterString>
</gmd:name>
<!-- Service Description -->
<gmd:description>
<gco:CharacterString>Full URL to request the OGC
getCapabilities document. This is the mechanism used to
acquire detailed operation description for USGIN
metadata.</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:value-of select="//ows:HTTP/ows:Get[1]/@xlink:href"
/>
</gmd:URL>
</gmd:linkage>
<!-- The protocol element defines a valid internet protocol used to access the resource. -->
<gmd:protocol>
<gco:CharacterString>http</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>baseURL</gco:CharacterString>
</gmd:name>
<!-- Service Description -->
<gmd:description>
<gco:CharacterString>Base URL for service access; append '?'
and standard CSW request parameters to compose
query.</gco:CharacterString>
</gmd:description>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</MD_Distribution>
</distributionInfo>
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<gmd:MD_ScopeCode
codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode"
codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:level>
</gmd:DQ_Scope>
</gmd:scope>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>
<xsl:value-of
select="concat('This metadata record harvested from ', $sourceUrl, '. and transformed to USGIN ISO19139 profile using ogcCSW-toUSGIN_ISO19139.xslt version 1.0')"
/>
</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</gmd:MD_Metadata>
</xsl:template>
</xsl:stylesheet>