geo_combine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,539 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ iso2geoBl.xsl - Transformation from ISO 19139 XML into GeoBlacklight solr
4
+
5
+ -->
6
+ <xsl:stylesheet
7
+ xmlns="http://www.loc.gov/mods/v3"
8
+ xmlns:gco="http://www.isotc211.org/2005/gco"
9
+ xmlns:gmi="http://www.isotc211.org/2005/gmi"
10
+ xmlns:gmd="http://www.isotc211.org/2005/gmd"
11
+ xmlns:gml="http://www.opengis.net/gml"
12
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
13
+ version="1.0" exclude-result-prefixes="gml gmd gco gmi xsl">
14
+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
15
+ <xsl:strip-space elements="*"/>
16
+ <xsl:param name="geometryType"/>
17
+ <xsl:param name="purl"/>
18
+ <xsl:param name="zipName" select="'data.zip'"/>
19
+
20
+
21
+
22
+
23
+
24
+ <xsl:template match="/">
25
+ <!-- institution -->
26
+ <xsl:variable name="institution">
27
+ <xsl:for-each select="gmd:MD_Metadata/gmd:contact/gmd:CI_ResponsibleParty">
28
+ <xsl:choose>
29
+
30
+ <!-- Stanford -->
31
+ <xsl:when test="contains(gmd:organisationName/gco:CharacterString, 'Stanford')">
32
+ <xsl:text>Stanford</xsl:text>
33
+ </xsl:when>
34
+
35
+ <!-- UVa -->
36
+ <xsl:when test="contains(gmd:organisationName/gco:CharacterString, 'Virginia')">
37
+ <xsl:text>UVa</xsl:text>
38
+ </xsl:when>
39
+ <xsl:when test="contains(gmd:organisationName/gco:CharacterString, 'Scholars&apos;)">
40
+ <xsl:text>UVa</xsl:text>
41
+ </xsl:when>
42
+
43
+ </xsl:choose>
44
+ </xsl:for-each>
45
+ </xsl:variable>
46
+
47
+ <!-- bounding box -->
48
+ <xsl:variable name="upperCorner">
49
+ <xsl:value-of select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal)"/>
50
+ <xsl:text> </xsl:text>
51
+ <xsl:value-of select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal)"/>
52
+ </xsl:variable>
53
+
54
+ <xsl:variable name="lowerCorner">
55
+ <xsl:value-of select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal)"/>
56
+ <xsl:text> </xsl:text>
57
+ <xsl:value-of select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal)"/>
58
+ </xsl:variable>
59
+
60
+ <xsl:variable name="x2" select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal)"/><!-- E -->
61
+ <xsl:variable name="x1" select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal)"/><!-- W -->
62
+ <xsl:variable name="y2" select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal)"/><!-- N -->
63
+ <xsl:variable name="y1" select="number(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal)"/><!-- S -->
64
+
65
+ <xsl:variable name="format">
66
+ <xsl:choose>
67
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'Raster Dataset')">
68
+ <xsl:text>image/tiff</xsl:text>
69
+ </xsl:when>
70
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'GeoTIFF')">
71
+ <xsl:text>image/tiff</xsl:text>
72
+ </xsl:when>
73
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'Shapefile')">
74
+ <xsl:text>application/x-esri-shapefile</xsl:text>
75
+ </xsl:when>
76
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:spatialRepresentationType/gmd:MD_SpatialRepresentationTypeCode/@codeListValue='vector'">
77
+ <xsl:text>application/x-esri-shapefile</xsl:text>
78
+ </xsl:when>
79
+ </xsl:choose>
80
+ </xsl:variable>
81
+
82
+ <xsl:variable name="uuid">
83
+ <xsl:choose>
84
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code">
85
+ <xsl:value-of select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code"/>
86
+ </xsl:when>
87
+ <xsl:when test="gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL">
88
+ <xsl:value-of select="gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL"/>
89
+ </xsl:when>
90
+ </xsl:choose>
91
+ </xsl:variable>
92
+
93
+ <xsl:variable name="identifier">
94
+ <xsl:choose>
95
+ <!-- for Stanford URIs -->
96
+ <xsl:when test="contains($uuid, 'purl')">
97
+ <xsl:value-of select="substring($uuid, string-length($uuid)-10)"/>
98
+ </xsl:when>
99
+ <!-- all others -->
100
+ <xsl:otherwise>
101
+ <xsl:value-of select="$uuid"/>
102
+ </xsl:otherwise>
103
+ </xsl:choose>
104
+ </xsl:variable>
105
+ <add>
106
+ <doc>
107
+ <field name="uuid">
108
+ <xsl:value-of select="$uuid"/>
109
+ </field>
110
+
111
+ <field name="dc_identifier_s">
112
+ <xsl:value-of select="$uuid"/>
113
+ </field>
114
+
115
+ <field name="dc_title_s">
116
+ <xsl:value-of select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title"/>
117
+ </field>
118
+
119
+ <field name="dc_description_s">
120
+ <xsl:value-of select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract"/>
121
+ </field>
122
+
123
+ <field name="dc_rights_s">
124
+ <xsl:choose>
125
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode[@codeListValue='restricted']">
126
+ <xsl:text>Restricted</xsl:text>
127
+ </xsl:when>
128
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode, 'restricted')">
129
+ <xsl:text>Restricted</xsl:text>
130
+ </xsl:when>
131
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:useConstraints/gmd:MD_RestrictionCode[@codeListValue='restricted']">
132
+ <xsl:text>Restricted</xsl:text>
133
+ </xsl:when>
134
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:useConstraints/gmd:MD_RestrictionCode, 'restricted')">
135
+ <xsl:text>Restricted</xsl:text>
136
+ </xsl:when>
137
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints">
138
+ <xsl:choose>
139
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints, 'restricted')">
140
+ <xsl:text>Restricted</xsl:text>
141
+ </xsl:when>
142
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints, 'public domain')">
143
+ <xsl:text>Public</xsl:text>
144
+ </xsl:when>
145
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints, $institution)">
146
+ <xsl:text>Restricted</xsl:text>
147
+ </xsl:when>
148
+ </xsl:choose>
149
+ </xsl:when>
150
+ <xsl:otherwise>
151
+ <xsl:text>Public</xsl:text>
152
+ </xsl:otherwise>
153
+ </xsl:choose>
154
+ </field>
155
+
156
+ <field name="dct_provenance_s">
157
+ <xsl:value-of select="$institution"/>
158
+ </field>
159
+
160
+ <field name="dct_references_s">
161
+ <xsl:text>{</xsl:text>
162
+ <xsl:text>"http://schema.org/url":"</xsl:text>
163
+ <xsl:value-of select="$uuid"/>
164
+ <xsl:text>",</xsl:text>
165
+ <!--<xsl:text>"http://schema.org/thumbnailUrl":"</xsl:text>
166
+ <xsl:value-of select="$stacks_root"/>
167
+ <xsl:text>/file/druid:</xsl:text>
168
+ <xsl:value-of select="$identifier"/>
169
+ <xsl:text>/preview.jpg",</xsl:text>
170
+ <xsl:text>"http://schema.org/DownloadAction":"</xsl:text>
171
+ <xsl:value-of select="$stacks_root"/>
172
+ <xsl:text>/file/druid:</xsl:text>
173
+ <xsl:value-of select="$identifier"/>
174
+ <xsl:text>/data.zip",</xsl:text>
175
+ <xsl:text>"http://www.loc.gov/mods/v3":"</xsl:text>
176
+ <xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
177
+ <xsl:value-of select="$identifier"/>
178
+ <xsl:text>/mods",</xsl:text>
179
+ <xsl:text>"http://www.isotc211.org/schemas/2005/gmd/":"</xsl:text>
180
+ <xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
181
+ <xsl:value-of select="$identifier"/>
182
+ <xsl:text>/iso19139",</xsl:text>
183
+ <xsl:text>"http://www.opengis.net/def/serviceType/ogc/wms":"</xsl:text>
184
+ <xsl:value-of select="$geoserver_root"/>
185
+ <xsl:text>/wms",</xsl:text>
186
+ <xsl:text>"http://www.opengis.net/def/serviceType/ogc/wfs":"</xsl:text>
187
+ <xsl:value-of select="$geoserver_root"/>
188
+ <xsl:text>/wfs",</xsl:text>
189
+ <xsl:text>"http://www.opengis.net/def/serviceType/ogc/wcs":"</xsl:text>
190
+ <xsl:value-of select="$geoserver_root"/>
191
+ <xsl:text>/wcs"</xsl:text> -->
192
+ <xsl:text>}</xsl:text>
193
+ </field>
194
+
195
+ <field name="layer_id_s">
196
+ <xsl:choose>
197
+ <xsl:when test="$institution = 'Stanford'">
198
+ <xsl:text>druid:</xsl:text>
199
+ <xsl:value-of select="$identifier"/>
200
+ </xsl:when>
201
+ <xsl:otherwise>
202
+ <xsl:text>urn:</xsl:text>
203
+ <xsl:value-of select="$identifier"/>
204
+ </xsl:otherwise>
205
+ </xsl:choose>
206
+ </field>
207
+
208
+ <field name="layer_slug_s">
209
+ <xsl:value-of select="$institution"/>
210
+ <xsl:text>-</xsl:text>
211
+ <xsl:value-of select="$identifier"/>
212
+ </field>
213
+
214
+ <field name="layer_geom_type_s">
215
+ <xsl:value-of select="$geometryType"/>
216
+ </field>
217
+
218
+ <xsl:choose>
219
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:dateStamp, 'T')">
220
+ <field name="layer_modified_dt">
221
+ <xsl:value-of select="substring-before(gmd:MD_Metadata/gmd:dateStamp, 'T')"/>
222
+ </field>
223
+ </xsl:when>
224
+ <xsl:when test="gmd:MD_Metadata/gmd:dateStamp">
225
+ <field name="layer_modified_dt">
226
+ <xsl:value-of select="gmd:MD_Metadata/gmd:dateStamp"/>
227
+ </field>
228
+ </xsl:when>
229
+ </xsl:choose>
230
+
231
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty">
232
+ <xsl:choose>
233
+ <xsl:when test="gmd:role/gmd:CI_RoleCode[@codeListValue='originator']">
234
+ <xsl:for-each select="gmd:organisationName">
235
+ <field name="dc_creator_sm">
236
+ <xsl:value-of select="."/>
237
+ </field>
238
+ </xsl:for-each>
239
+ <xsl:for-each select="gmd:individualName">
240
+ <field name="dc_creator_sm">
241
+ <xsl:value-of select="."/>
242
+ </field>
243
+ </xsl:for-each>
244
+ </xsl:when>
245
+
246
+ <xsl:when test="gmd:role/gmd:CI_RoleCode[@codeListValue='publisher']">
247
+ <xsl:for-each select="gmd:organisationName">
248
+ <field name="dc_publisher_sm">
249
+ <xsl:value-of select="."/>
250
+ </field>
251
+ </xsl:for-each>
252
+ <xsl:for-each select="gmd:individualName">
253
+ <field name="dc_creator_sm">
254
+ <xsl:value-of select="."/>
255
+ </field>
256
+ </xsl:for-each>
257
+ </xsl:when>
258
+ </xsl:choose>
259
+ </xsl:for-each>
260
+
261
+ <field name="dc_format_s">
262
+ <xsl:value-of select="$format"/>
263
+ </field>
264
+
265
+ <!-- TODO: add inputs for other languages -->
266
+ <field name="dc_language_s">
267
+ <xsl:if test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:language | gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:language/gmd:LanguageCode, 'eng')">
268
+ <xsl:text>English</xsl:text>
269
+ </xsl:if>
270
+ </field>
271
+
272
+ <!-- from DCMI type vocabulary -->
273
+ <xsl:choose>
274
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:hierarchyLevelName/gco:CharacterString, 'dataset')">
275
+ <field name="dc_type_s">
276
+ <xsl:text>Dataset</xsl:text>
277
+ </field>
278
+ </xsl:when>
279
+
280
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:hierarchyLevelName/gco:CharacterString, 'service')">
281
+ <field name="dc_type_s">
282
+ <xsl:text>Service</xsl:text>
283
+ </field>
284
+ </xsl:when>
285
+ </xsl:choose>
286
+
287
+ <!-- translate ISO topic categories -->
288
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode">
289
+ <field name="dc_subject_sm">
290
+ <xsl:choose>
291
+ <xsl:when test="contains(.,'farming')">
292
+ <xsl:text>Farming</xsl:text>
293
+ </xsl:when>
294
+ <xsl:when test="contains(.,'biota')">
295
+ <xsl:text>Biology and Ecology</xsl:text>
296
+ </xsl:when>
297
+ <xsl:when test="contains(.,'climatologyMeteorologyAtmosphere')">
298
+ <xsl:text>Climatology, Meteorology and Atmosphere</xsl:text>
299
+ </xsl:when>
300
+ <xsl:when test="contains(.,'boundaries')">
301
+ <xsl:text>Boundaries</xsl:text>
302
+ </xsl:when>
303
+ <xsl:when test="contains(.,'elevation')">
304
+ <xsl:text>Elevation</xsl:text>
305
+ </xsl:when>
306
+ <xsl:when test="contains(.,'environment')">
307
+ <xsl:text>Environment</xsl:text>
308
+ </xsl:when>
309
+ <xsl:when test="contains(.,'geoscientificInformation')">
310
+ <xsl:text>Geoscientific Information</xsl:text>
311
+ </xsl:when>
312
+ <xsl:when test="contains(.,'health')">
313
+ <xsl:text>Health</xsl:text>
314
+ </xsl:when>
315
+ <xsl:when test="contains(.,'imageryBaseMapsEarthCover')">
316
+ <xsl:text>Imagery and Base Maps</xsl:text>
317
+ </xsl:when>
318
+ <xsl:when test="contains(.,'intelligenceMilitary')">
319
+ <xsl:text>Military</xsl:text>
320
+ </xsl:when>
321
+ <xsl:when test="contains(.,'inlandWaters')">
322
+ <xsl:text>Inland Waters</xsl:text>
323
+ </xsl:when>
324
+ <xsl:when test="contains(.,'location')">
325
+ <xsl:text>Location</xsl:text>
326
+ </xsl:when>
327
+ <xsl:when test="contains(.,'oceans')">
328
+ <xsl:text>Oceans</xsl:text>
329
+ </xsl:when>
330
+ <xsl:when test="contains(.,'planningCadastre')">
331
+ <xsl:text>Planning and Cadastral</xsl:text>
332
+ </xsl:when>
333
+ <xsl:when test="contains(.,'structure')">
334
+ <xsl:text>Structure</xsl:text>
335
+ </xsl:when>
336
+ <xsl:when test="contains(.,'transportation')">
337
+ <xsl:text>Transportation</xsl:text>
338
+ </xsl:when>
339
+ <xsl:when test="contains(.,'utilitiesCommunication')">
340
+ <xsl:text>Utilities and Communication</xsl:text>
341
+ </xsl:when>
342
+ <xsl:when test="contains(.,'society')">
343
+ <xsl:text>Society</xsl:text>
344
+ </xsl:when>
345
+ <xsl:when test="contains(.,'economy')">
346
+ <xsl:text>Economy</xsl:text>
347
+ </xsl:when>
348
+ <xsl:otherwise>
349
+ <xsl:value-of select="."/>
350
+ </xsl:otherwise>
351
+ </xsl:choose>
352
+ </field>
353
+ </xsl:for-each>
354
+
355
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
356
+ <xsl:choose>
357
+ <xsl:when test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='theme']">
358
+ <xsl:for-each select="gmd:keyword">
359
+ <field name="dc_subject_sm">
360
+ <xsl:value-of select="."/>
361
+ </field>
362
+ </xsl:for-each>
363
+ </xsl:when>
364
+
365
+ <xsl:when test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='place']">
366
+ <xsl:for-each select="gmd:keyword">
367
+ <field name="dc_spatial_sm">
368
+ <xsl:value-of select="."/>
369
+ </field>
370
+ </xsl:for-each>
371
+ </xsl:when>
372
+ </xsl:choose>
373
+ </xsl:for-each>
374
+
375
+ <xsl:choose>
376
+ <xsl:when test="contains(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:DateTime, 'T')">
377
+ <field name="dct_issued_s">
378
+ <xsl:value-of select="substring-before(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:DateTime,'T')"/>
379
+ </field>
380
+ </xsl:when>
381
+
382
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:DateTime">
383
+ <field name="dct_issued_s">
384
+ <xsl:value-of select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:DateTime"/>
385
+ </field>
386
+ </xsl:when>
387
+
388
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:Date">
389
+ <field name="dct_issued_s">
390
+ <xsl:value-of select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:Date"/>
391
+ </field>
392
+ </xsl:when>
393
+
394
+ <xsl:otherwise>unknown</xsl:otherwise>
395
+ </xsl:choose>
396
+
397
+
398
+ <!-- content date: range YYYY-YYYY if dates differ -->
399
+ <xsl:choose>
400
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition/text() != ''">
401
+ <field name="dct_temporal_sm">
402
+ <xsl:value-of select="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition, 1,4)"/>
403
+ <xsl:if test="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition, 1,4) != substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition,1,4)">
404
+ <xsl:text>-</xsl:text>
405
+ <xsl:value-of select="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition, 1,4)"/>
406
+ </xsl:if>
407
+ </field>
408
+ </xsl:when>
409
+
410
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimeInstant">
411
+ <field name="dct_temporal_sm">
412
+ <xsl:value-of select="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimeInstant, 1,4)"/>
413
+ </field>
414
+ </xsl:when>
415
+ </xsl:choose>
416
+
417
+ <!-- collection -->
418
+ <xsl:choose>
419
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:associationType/gmd:DS_AssociationTypeCode[@codeListValue='largerWorkCitation']">
420
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:associationType/gmd:DS_AssociationTypeCode[@codeListValue='largerWorkCitation']">
421
+ <field name="dct_isPartOf_sm">
422
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:title"/>
423
+ </field>
424
+ </xsl:for-each>
425
+ </xsl:when>
426
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:collectiveTitle">
427
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:collectiveTitle">
428
+ <field name="dct_isPartOf_sm">
429
+ <xsl:value-of select="."/>
430
+ </field>
431
+ </xsl:for-each>
432
+ </xsl:when>
433
+ </xsl:choose>
434
+
435
+ <!-- cross-references -->
436
+ <xsl:for-each select="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:associationType/gmd:DS_AssociationTypeCode[@codeListValue='crossReference']">
437
+ <field name="dc_relation_sm">
438
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:title"/>
439
+ </field>
440
+ </xsl:for-each>
441
+
442
+ <field name="georss_polygon_s">
443
+ <xsl:text></xsl:text>
444
+ <xsl:value-of select="$y1"/>
445
+ <xsl:text> </xsl:text>
446
+ <xsl:value-of select="$x1"/>
447
+ <xsl:text> </xsl:text>
448
+ <xsl:value-of select="$y2"/>
449
+ <xsl:text> </xsl:text>
450
+ <xsl:value-of select="$x1"/>
451
+ <xsl:text> </xsl:text>
452
+ <xsl:value-of select="$y2"/>
453
+ <xsl:text> </xsl:text>
454
+ <xsl:value-of select="$x2"/>
455
+ <xsl:text> </xsl:text>
456
+ <xsl:value-of select="$y1"/>
457
+ <xsl:text> </xsl:text>
458
+ <xsl:value-of select="$x2"/>
459
+ <xsl:text> </xsl:text>
460
+ <xsl:value-of select="$y1"/>
461
+ <xsl:text> </xsl:text>
462
+ <xsl:value-of select="$x1"/>
463
+ </field>
464
+
465
+ <field name="solr_geom">
466
+ <xsl:text>ENVELOPE((</xsl:text>
467
+ <xsl:value-of select="$x1"/>
468
+ <xsl:text> </xsl:text>
469
+ <xsl:value-of select="$y1"/>
470
+ <xsl:text>, </xsl:text>
471
+ <xsl:value-of select="$x2"/>
472
+ <xsl:text> </xsl:text>
473
+ <xsl:value-of select="$y1"/>
474
+ <xsl:text>, </xsl:text>
475
+ <xsl:value-of select="$x2"/>
476
+ <xsl:text> </xsl:text>
477
+ <xsl:value-of select="$y2"/>
478
+ <xsl:text>, </xsl:text>
479
+ <xsl:value-of select="$x1"/>
480
+ <xsl:text> </xsl:text>
481
+ <xsl:value-of select="$y2"/>
482
+ <xsl:text>, </xsl:text>
483
+ <xsl:value-of select="$x1"/>
484
+ <xsl:text> </xsl:text>
485
+ <xsl:value-of select="$y1"/>
486
+ <xsl:text>))</xsl:text>
487
+ </field>
488
+
489
+ <field name="georss_box_s">
490
+ <xsl:value-of select="$y1"/>
491
+ <xsl:text> </xsl:text>
492
+ <xsl:value-of select="$x1"/>
493
+ <xsl:text> </xsl:text>
494
+ <xsl:value-of select="$y2"/>
495
+ <xsl:text> </xsl:text>
496
+ <xsl:value-of select="$x2"/>
497
+ </field>
498
+
499
+
500
+ <field name="solr_bbox">
501
+ <xsl:value-of select="$x1"/>
502
+ <xsl:text> </xsl:text>
503
+ <xsl:value-of select="$y1"/>
504
+ <xsl:text> </xsl:text>
505
+ <xsl:value-of select="$x2"/>
506
+ <xsl:text> </xsl:text>
507
+ <xsl:value-of select="$y2"/>
508
+ </field>
509
+
510
+ <field name="solr_sw_pt">
511
+ <xsl:value-of select="$y1"/>
512
+ <xsl:text>,</xsl:text>
513
+ <xsl:value-of select="$x1"/>
514
+ </field>
515
+
516
+ <field name="solr_ne_pt">
517
+ <xsl:value-of select="$y2"/>
518
+ <xsl:text>,</xsl:text>
519
+ <xsl:value-of select="$x2"/>
520
+ </field>
521
+
522
+ <!-- content date: singular, or beginning date of range: YYYY -->
523
+ <xsl:choose>
524
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition/text() != ''">
525
+ <field name="solr_year_i">
526
+ <xsl:value-of select="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition, 1,4)"/>
527
+ </field>
528
+ </xsl:when>
529
+ <xsl:when test="gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimeInstant">
530
+ <field name="solr_year_i">
531
+ <xsl:value-of select="substring(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimeInstant, 1,4)"/>
532
+ </field>
533
+ </xsl:when>
534
+ </xsl:choose>
535
+ </doc>
536
+ </add>
537
+ </xsl:template>
538
+
539
+ </xsl:stylesheet>