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.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/README.md +14 -0
- data/Rakefile +20 -0
- data/geo_combine.gemspec +2 -0
- data/lib/geo_combine/fgdc.rb +14 -0
- data/lib/geo_combine/geoblacklight.rb +25 -0
- data/lib/geo_combine/iso19139.rb +12 -0
- data/lib/geo_combine/version.rb +1 -1
- data/lib/geo_combine.rb +35 -2
- data/lib/xslt/fgdc2geoBL.xsl +588 -0
- data/lib/xslt/iso2geoBL.xsl +539 -0
- data/spec/fixtures/xml_docs.rb +1725 -0
- data/spec/helpers.rb +13 -0
- data/spec/lib/geo_combine/fgdc_spec.rb +22 -0
- data/spec/lib/geo_combine/geoblacklight_spec.rb +16 -0
- data/spec/lib/geo_combine/iso19139_spec.rb +21 -0
- data/spec/lib/geo_combine_spec.rb +22 -0
- data/spec/spec_helper.rb +99 -0
- metadata +53 -3
@@ -0,0 +1,588 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
fgdc2geoBL.xsl - Transformation from FGDC 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="2.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
|
+
|
17
|
+
<xsl:param name="zipName" select="'data.zip'"/>
|
18
|
+
|
19
|
+
|
20
|
+
<xsl:variable name="institution">
|
21
|
+
<xsl:for-each select="metadata">
|
22
|
+
<xsl:choose>
|
23
|
+
<xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Harvard')">
|
24
|
+
<xsl:text>Harvard</xsl:text>
|
25
|
+
</xsl:when>
|
26
|
+
<xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'Tufts')">
|
27
|
+
<xsl:text>Tufts</xsl:text>
|
28
|
+
</xsl:when>
|
29
|
+
<xsl:when test="contains(distinfo/distrib/cntinfo/cntorgp/cntorg, 'MIT')">
|
30
|
+
<xsl:text>MIT</xsl:text>
|
31
|
+
</xsl:when>
|
32
|
+
<xsl:when test="contains(cntinfo/cntorgp/cntorg, 'Massachusetts')">
|
33
|
+
<xsl:text>MassGIS</xsl:text>
|
34
|
+
</xsl:when>
|
35
|
+
<xsl:when test="contains(metainfo/metc/cntinfo/cntorgp/cntorg, 'MassGIS')">
|
36
|
+
<xsl:text>MassGIS</xsl:text>
|
37
|
+
</xsl:when>
|
38
|
+
<xsl:when test="contains(distinfo/distrib/cntinfo/cntemail, 'state.ma.us')">
|
39
|
+
<xsl:text>MassGIS</xsl:text>
|
40
|
+
</xsl:when>
|
41
|
+
<xsl:when test="contains(metainfo/metc/cntinfo/cntemail, 'ca.gov')">
|
42
|
+
<xsl:text>Berkeley</xsl:text>
|
43
|
+
</xsl:when>
|
44
|
+
<xsl:when test="contains(metainfo/metc/cntinfo/cntorgp/cntorg, 'Columbia')">
|
45
|
+
<xsl:text>Columbia</xsl:text>
|
46
|
+
</xsl:when>
|
47
|
+
<xsl:when test="contains(metainfo/metc/cntinfo/cntorgp/cntorg, 'Harvard')">
|
48
|
+
<xsl:text>Harvard</xsl:text>
|
49
|
+
</xsl:when>
|
50
|
+
|
51
|
+
</xsl:choose>
|
52
|
+
</xsl:for-each>
|
53
|
+
</xsl:variable>
|
54
|
+
|
55
|
+
<!-- Output bounding box -->
|
56
|
+
<xsl:variable name="upperCorner">
|
57
|
+
<xsl:value-of select="number(metadata/idinfo/spdom/bounding/eastbc)"/>
|
58
|
+
<xsl:text> </xsl:text>
|
59
|
+
<xsl:value-of select="number(metadata/idinfo/spdom/bounding/northbc)"/>
|
60
|
+
</xsl:variable>
|
61
|
+
|
62
|
+
<xsl:variable name="lowerCorner">
|
63
|
+
|
64
|
+
<xsl:value-of select="number(metadata/idinfo/spdom/bounding/westbc)"/>
|
65
|
+
<xsl:text> </xsl:text>
|
66
|
+
<xsl:value-of select="number(metadata/idinfo/spdom/bounding/southbc)"/>
|
67
|
+
|
68
|
+
</xsl:variable>
|
69
|
+
<xsl:variable name="x2" select="number(metadata/idinfo/spdom/bounding/eastbc)"/><!-- E -->
|
70
|
+
<xsl:variable name="x1" select="number(metadata/idinfo/spdom/bounding/westbc)"/><!-- W -->
|
71
|
+
<xsl:variable name="y2" select="number(metadata/idinfo/spdom/bounding/northbc)"/><!-- N -->
|
72
|
+
<xsl:variable name="y1" select="number(metadata/idinfo/spdom/bounding/southbc)"/><!-- S -->
|
73
|
+
|
74
|
+
|
75
|
+
<xsl:variable name="format">
|
76
|
+
<xsl:choose>
|
77
|
+
<xsl:when test="contains(metadata/idinfo/citation/citeinfo/geoform, 'raster digital data')">
|
78
|
+
<xsl:text>image/tiff</xsl:text>
|
79
|
+
</xsl:when>
|
80
|
+
<xsl:when test="contains(metadata/idinfo/citation/citeinfo/geoform, 'vector digital data')">
|
81
|
+
<xsl:text>application/x-esri-shapefile</xsl:text>
|
82
|
+
</xsl:when>
|
83
|
+
<xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'TIFF')">
|
84
|
+
<xsl:text>image/tiff</xsl:text>
|
85
|
+
</xsl:when>
|
86
|
+
<xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'JPEG2000')">
|
87
|
+
<xsl:text>image/tiff</xsl:text>
|
88
|
+
</xsl:when>
|
89
|
+
<xsl:when test="contains(metadata/distinfo/stdorder/digform/digtinfo/formname, 'Shape')">
|
90
|
+
<xsl:text>application/x-esri-shapefile</xsl:text>
|
91
|
+
</xsl:when>
|
92
|
+
</xsl:choose>
|
93
|
+
</xsl:variable>
|
94
|
+
|
95
|
+
|
96
|
+
<xsl:variable name="uuid">
|
97
|
+
<xsl:choose>
|
98
|
+
<xsl:when test="$institution = 'Harvard'">
|
99
|
+
<xsl:value-of select="substring-after(metadata/idinfo/citation/citeinfo/onlink, 'CollName=')"/>
|
100
|
+
</xsl:when>
|
101
|
+
<xsl:when test="$institution = 'MIT'">
|
102
|
+
<xsl:value-of select="metadata/spdoinfo/ptvctinf/sdtsterm/@Name"/>
|
103
|
+
</xsl:when>
|
104
|
+
<xsl:when test="$institution = 'Tufts'">
|
105
|
+
<xsl:value-of select="metadata/spdoinfo/ptvctinf/sdtsterm/@Name"/>
|
106
|
+
</xsl:when>
|
107
|
+
</xsl:choose>
|
108
|
+
</xsl:variable>
|
109
|
+
|
110
|
+
|
111
|
+
<xsl:template match="metadata">
|
112
|
+
<add>
|
113
|
+
<doc>
|
114
|
+
<field name="uuid">
|
115
|
+
<xsl:value-of select="$uuid"/>
|
116
|
+
</field>
|
117
|
+
<field name="dc_identifier_s">
|
118
|
+
<xsl:value-of select="idinfo/citation/citeinfo/onlink"/>
|
119
|
+
</field>
|
120
|
+
|
121
|
+
<field name="dc_title_s">
|
122
|
+
<xsl:value-of select="idinfo/citation/citeinfo/title"/>
|
123
|
+
</field>
|
124
|
+
<field name="dc_description_s">
|
125
|
+
<xsl:value-of select="idinfo/descript/abstract"/>
|
126
|
+
</field>
|
127
|
+
|
128
|
+
|
129
|
+
<field name="dc_rights_s">
|
130
|
+
<xsl:choose>
|
131
|
+
<xsl:when test="contains(idinfo/accconst, 'Restricted')">
|
132
|
+
<xsl:text>Restricted</xsl:text>
|
133
|
+
</xsl:when>
|
134
|
+
<xsl:when test="contains(idinfo/accconst, 'Unrestricted')">
|
135
|
+
<xsl:text>Public</xsl:text>
|
136
|
+
</xsl:when>
|
137
|
+
<xsl:when test="contains(idinfo/accconst, $institution)">
|
138
|
+
<xsl:text>Restricted</xsl:text>
|
139
|
+
</xsl:when>
|
140
|
+
<xsl:when test="contains(idinfo/accconst, 'None')">
|
141
|
+
<xsl:text>Public</xsl:text>
|
142
|
+
</xsl:when>
|
143
|
+
<xsl:when test="contains(idinfo/useconst, 'Restricted')">
|
144
|
+
<xsl:text>Restricted</xsl:text>
|
145
|
+
</xsl:when>
|
146
|
+
<xsl:when test="contains(idinfo/useconst, $institution)">
|
147
|
+
<xsl:text>Restricted</xsl:text>
|
148
|
+
</xsl:when>
|
149
|
+
<xsl:when test="contains(idinfo/useconst, 'None')">
|
150
|
+
<xsl:text>Public</xsl:text>
|
151
|
+
</xsl:when>
|
152
|
+
</xsl:choose>
|
153
|
+
</field>
|
154
|
+
|
155
|
+
<field name="dct_provenance_s">
|
156
|
+
<xsl:value-of select="$institution"/>
|
157
|
+
</field>
|
158
|
+
|
159
|
+
<!-- <field name="dct_references_s">
|
160
|
+
<xsl:text>{</xsl:text>
|
161
|
+
<xsl:text>"http://schema.org/url":"</xsl:text>
|
162
|
+
<xsl:value-of select="$purl"/>
|
163
|
+
<xsl:text>",</xsl:text>
|
164
|
+
<xsl:text>"http://schema.org/thumbnailUrl":"</xsl:text>
|
165
|
+
<xsl:value-of select="$stacks_root"/>
|
166
|
+
<xsl:text>/file/druid:</xsl:text>
|
167
|
+
<xsl:value-of select="$druid"/>
|
168
|
+
<xsl:text>/preview.jpg",</xsl:text>
|
169
|
+
<xsl:text>"http://schema.org/DownloadAction":"</xsl:text>
|
170
|
+
<xsl:value-of select="$stacks_root"/>
|
171
|
+
<xsl:text>/file/druid:</xsl:text>
|
172
|
+
<xsl:value-of select="$druid"/>
|
173
|
+
<xsl:text>/data.zip",</xsl:text>
|
174
|
+
<xsl:text>"http://www.loc.gov/mods/v3":"</xsl:text>
|
175
|
+
<xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
|
176
|
+
<xsl:value-of select="$druid"/>
|
177
|
+
<xsl:text>/mods",</xsl:text>
|
178
|
+
<xsl:text>"http://www.isotc211.org/schemas/2005/gmd/":"</xsl:text>
|
179
|
+
<xsl:text>http://earthworks.stanford.edu/opengeometadata/layers/edu.stanford.purl/</xsl:text>
|
180
|
+
<xsl:value-of select="$druid"/>
|
181
|
+
<xsl:text>/iso19139",</xsl:text>
|
182
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wms":"</xsl:text>
|
183
|
+
<xsl:value-of select="$geoserver_root"/>
|
184
|
+
<xsl:text>/wms",</xsl:text>
|
185
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wfs":"</xsl:text>
|
186
|
+
<xsl:value-of select="$geoserver_root"/>
|
187
|
+
<xsl:text>/wfs",</xsl:text>
|
188
|
+
<xsl:text>"http://www.opengis.net/def/serviceType/ogc/wcs":"</xsl:text>
|
189
|
+
<xsl:value-of select="$geoserver_root"/>
|
190
|
+
<xsl:text>/wcs"</xsl:text>
|
191
|
+
<xsl:text>}</xsl:text>
|
192
|
+
</field> -->
|
193
|
+
|
194
|
+
<field name="layer_id_s">
|
195
|
+
<xsl:text>urn:</xsl:text>
|
196
|
+
<xsl:value-of select="$uuid"/>
|
197
|
+
</field>
|
198
|
+
|
199
|
+
<field name="layer_slug_s">
|
200
|
+
<xsl:value-of select="lower-case($institution)"/>
|
201
|
+
<xsl:text>-</xsl:text>
|
202
|
+
<xsl:value-of select="$uuid"/>
|
203
|
+
</field>
|
204
|
+
|
205
|
+
|
206
|
+
<xsl:choose>
|
207
|
+
<xsl:when test="contains(spdoinfo/ptvctinf/sdtsterm/sdtstype, 'G-polygon')">
|
208
|
+
<field name="layer_geom_type_s">
|
209
|
+
<xsl:text>Polygon</xsl:text>
|
210
|
+
</field>
|
211
|
+
</xsl:when>
|
212
|
+
<xsl:when test="contains(spdoinfo/ptvctinf/sdtsterm/sdtstype, 'Entity point')">
|
213
|
+
<field name="layer_geom_type_s">
|
214
|
+
<xsl:text>Point</xsl:text>
|
215
|
+
</field>
|
216
|
+
</xsl:when>
|
217
|
+
|
218
|
+
<xsl:when test="contains(spdoinfo/ptvctinf/sdtsterm/sdtstype, 'String')">
|
219
|
+
<field name="layer_geom_type_s">
|
220
|
+
<xsl:text>Line</xsl:text>
|
221
|
+
</field>
|
222
|
+
</xsl:when>
|
223
|
+
<xsl:when test="contains(spdoinfo/direct, 'Raster')">
|
224
|
+
<field name="layer_geom_type_s">
|
225
|
+
<xsl:text>Raster</xsl:text>
|
226
|
+
</field>
|
227
|
+
</xsl:when>
|
228
|
+
</xsl:choose>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<xsl:choose>
|
233
|
+
<xsl:when test="string-length(metainfo/metd)=4">
|
234
|
+
<field name="layer_modified_dt">
|
235
|
+
<xsl:value-of select="metainfo/metd"/>
|
236
|
+
</field>
|
237
|
+
</xsl:when>
|
238
|
+
|
239
|
+
<xsl:when test="string-length(metainfo/metd)=6">
|
240
|
+
<field name="layer_modified_dt">
|
241
|
+
<xsl:value-of select="substring(metainfo/metd,1,4)"/>
|
242
|
+
<xsl:text>-</xsl:text>
|
243
|
+
<xsl:value-of select="substring(metainfo/metd,5,2)"/>
|
244
|
+
</field>
|
245
|
+
</xsl:when>
|
246
|
+
|
247
|
+
<xsl:when test="string-length(metainfo/metd)=8">
|
248
|
+
<field name="layer_modified_dt">
|
249
|
+
<xsl:value-of select="substring(metainfo/metd,1,4)"/>
|
250
|
+
<xsl:text>-</xsl:text>
|
251
|
+
<xsl:value-of select="substring(metainfo/metd,5,2)"/>
|
252
|
+
<xsl:text>-</xsl:text>
|
253
|
+
<xsl:value-of select="substring(metainfo/metd,7,2)"/>
|
254
|
+
</field>
|
255
|
+
</xsl:when>
|
256
|
+
</xsl:choose>
|
257
|
+
|
258
|
+
|
259
|
+
<xsl:for-each select="idinfo/citation/citeinfo/origin">
|
260
|
+
<field name="dc_creator_sm">
|
261
|
+
<xsl:value-of select="."/>
|
262
|
+
</field>
|
263
|
+
</xsl:for-each>
|
264
|
+
|
265
|
+
<xsl:for-each select="idinfo/citation/citeinfo/pubinfo/publish">
|
266
|
+
<field name="dc_publisher_sm">
|
267
|
+
<xsl:value-of select="."/>
|
268
|
+
</field>
|
269
|
+
</xsl:for-each>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<field name="dc_format_s">
|
274
|
+
<xsl:value-of select="$format"/>
|
275
|
+
</field>
|
276
|
+
|
277
|
+
<!-- TODO: map other languages -->
|
278
|
+
<xsl:if test="contains(idinfo/descript/langdata, 'en')">
|
279
|
+
<field name="dc_language_s">
|
280
|
+
<xsl:text>English</xsl:text>
|
281
|
+
</field>
|
282
|
+
</xsl:if>
|
283
|
+
|
284
|
+
<!-- DCMI Type vocabulary: defaults to dataset -->
|
285
|
+
<field name="dc_type_s">
|
286
|
+
<xsl:text>Dataset</xsl:text>
|
287
|
+
</field>
|
288
|
+
|
289
|
+
|
290
|
+
<!-- translate ISO topic categories -->
|
291
|
+
<xsl:for-each select="idinfo/keywords/theme">
|
292
|
+
<xsl:choose>
|
293
|
+
<xsl:when test="contains(themekt, '19115')">
|
294
|
+
<xsl:for-each select="themekey">
|
295
|
+
|
296
|
+
<field name="dc_subject_sm">
|
297
|
+
<xsl:choose>
|
298
|
+
<xsl:when test="contains(.,'farming')">
|
299
|
+
|
300
|
+
<xsl:text>Farming</xsl:text>
|
301
|
+
</xsl:when>
|
302
|
+
<xsl:when test="contains(.,'biota')">
|
303
|
+
|
304
|
+
<xsl:text>Biology and Ecology</xsl:text>
|
305
|
+
</xsl:when>
|
306
|
+
<xsl:when test="contains(.,'climatologyMeteorologyAtmosphere')">\
|
307
|
+
|
308
|
+
<xsl:text>Climatology, Meteorology and Atmosphere</xsl:text>
|
309
|
+
</xsl:when>
|
310
|
+
<xsl:when test="contains(.,'boundaries')">
|
311
|
+
|
312
|
+
<xsl:text>Boundaries</xsl:text>
|
313
|
+
</xsl:when>
|
314
|
+
<xsl:when test="contains(.,'elevation')">
|
315
|
+
|
316
|
+
<xsl:text>Elevation</xsl:text>
|
317
|
+
</xsl:when>
|
318
|
+
<xsl:when test="contains(.,'environment')">
|
319
|
+
|
320
|
+
<xsl:text>Environment</xsl:text>
|
321
|
+
</xsl:when>
|
322
|
+
<xsl:when test="contains(.,'geoscientificInformation')">
|
323
|
+
|
324
|
+
<xsl:text>Geoscientific Information</xsl:text>
|
325
|
+
</xsl:when>
|
326
|
+
<xsl:when test="contains(.,'health')">
|
327
|
+
|
328
|
+
<xsl:text>Health</xsl:text>
|
329
|
+
</xsl:when>
|
330
|
+
<xsl:when test="contains(.,'imageryBaseMapsEarthCover')">
|
331
|
+
|
332
|
+
<xsl:text>Imagery and Base Maps</xsl:text>
|
333
|
+
</xsl:when>
|
334
|
+
<xsl:when test="contains(.,'intelligenceMilitary')">
|
335
|
+
|
336
|
+
<xsl:text>Military</xsl:text>
|
337
|
+
</xsl:when>
|
338
|
+
<xsl:when test="contains(.,'inlandWaters')">
|
339
|
+
|
340
|
+
<xsl:text>Inland Waters</xsl:text>
|
341
|
+
</xsl:when>
|
342
|
+
<xsl:when test="contains(.,'location')">
|
343
|
+
|
344
|
+
<xsl:text>Location</xsl:text>
|
345
|
+
</xsl:when>
|
346
|
+
<xsl:when test="contains(.,'oceans')">
|
347
|
+
|
348
|
+
<xsl:text>Oceans</xsl:text>
|
349
|
+
</xsl:when>
|
350
|
+
<xsl:when test="contains(.,'planningCadastre')">
|
351
|
+
|
352
|
+
<xsl:text>Planning and Cadastral</xsl:text>
|
353
|
+
</xsl:when>
|
354
|
+
<xsl:when test="contains(.,'structure')">
|
355
|
+
|
356
|
+
<xsl:text>Structure</xsl:text>
|
357
|
+
</xsl:when>
|
358
|
+
<xsl:when test="contains(.,'transportation')">
|
359
|
+
|
360
|
+
<xsl:text>Transportation</xsl:text>
|
361
|
+
</xsl:when>
|
362
|
+
<xsl:when test="contains(.,'utilitiesCommunication')">
|
363
|
+
|
364
|
+
<xsl:text>Utilities and Communication</xsl:text>
|
365
|
+
</xsl:when>
|
366
|
+
<xsl:when test="contains(.,'society')">
|
367
|
+
|
368
|
+
<xsl:text>Society</xsl:text>
|
369
|
+
</xsl:when>
|
370
|
+
<xsl:when test="contains(.,'economy')">
|
371
|
+
|
372
|
+
<xsl:text>Economy</xsl:text>
|
373
|
+
</xsl:when>
|
374
|
+
</xsl:choose>
|
375
|
+
</field>
|
376
|
+
</xsl:for-each>
|
377
|
+
</xsl:when>
|
378
|
+
|
379
|
+
<xsl:when test="not(themekt = 'FGDC')">
|
380
|
+
<xsl:for-each select="themekey">
|
381
|
+
<field name="dc_subject_sm">
|
382
|
+
<xsl:value-of select="."/>
|
383
|
+
</field>
|
384
|
+
</xsl:for-each>
|
385
|
+
</xsl:when>
|
386
|
+
</xsl:choose>
|
387
|
+
</xsl:for-each>
|
388
|
+
|
389
|
+
<xsl:for-each select="idinfo/keywords/place/placekey">
|
390
|
+
<field name="dc_spatial_sm">
|
391
|
+
<xsl:value-of select="."/>
|
392
|
+
</field>
|
393
|
+
</xsl:for-each>
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<xsl:choose>
|
399
|
+
<xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=4">
|
400
|
+
<field name="dct_issued_s">
|
401
|
+
<xsl:value-of select="idinfo/citation/citeinfo/pubdate"/>
|
402
|
+
</field>
|
403
|
+
</xsl:when>
|
404
|
+
|
405
|
+
<xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=6">
|
406
|
+
<field name="dct_issued_s">
|
407
|
+
<xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
|
408
|
+
<xsl:text>-</xsl:text>
|
409
|
+
<xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
|
410
|
+
</field>
|
411
|
+
</xsl:when>
|
412
|
+
|
413
|
+
<xsl:when test="string-length(idinfo/citation/citeinfo/pubdate)=8">
|
414
|
+
<field name="dct_issued_s">
|
415
|
+
<xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,1,4)"/>
|
416
|
+
<xsl:text>-</xsl:text>
|
417
|
+
<xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,5,2)"/>
|
418
|
+
<xsl:text>-</xsl:text>
|
419
|
+
<xsl:value-of select="substring(idinfo/citation/citeinfo/pubdate,7,2)"/>
|
420
|
+
</field>
|
421
|
+
</xsl:when>
|
422
|
+
</xsl:choose>
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
<!-- singular content date: YYYY -->
|
427
|
+
|
428
|
+
<xsl:choose>
|
429
|
+
<xsl:when test="idinfo/timeperd/timeinfo/sngdate/caldate">
|
430
|
+
<field name="dct_temporal_sm">
|
431
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)"/>
|
432
|
+
</field>
|
433
|
+
</xsl:when>
|
434
|
+
<xsl:when test="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate">
|
435
|
+
<field name="dct_temporal_sm">
|
436
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/mdattim/sngdate/caldate,1,4)"/>
|
437
|
+
</field>
|
438
|
+
</xsl:when>
|
439
|
+
|
440
|
+
<!-- YYYY-MM, YYYY-MM-DD
|
441
|
+
<xsl:when test="string-length(idinfo/timeperd/timeinfo/sngdate/caldate)=4">
|
442
|
+
<xsl:value-of select="idinfo/timeperd/timeinfo/sngdate/caldate"/>
|
443
|
+
</xsl:when>
|
444
|
+
<xsl:when test="string-length(idinfo/timeperd/timeinfo/sngdate/caldate)=6">
|
445
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)"/>
|
446
|
+
<xsl:text>-</xsl:text>
|
447
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,5,2)"/>
|
448
|
+
</xsl:when>
|
449
|
+
<xsl:when test="string-length(idinfo/timeperd/timeinfo/sngdate/caldate)=8">
|
450
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)"/>
|
451
|
+
<xsl:text>-</xsl:text>
|
452
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,5,2)"/>
|
453
|
+
<xsl:text>-</xsl:text>
|
454
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,7,2)"/>
|
455
|
+
</xsl:when> -->
|
456
|
+
|
457
|
+
<!-- content date range: YYYY-YYYY if dates differ -->
|
458
|
+
<xsl:when test="idinfo/timeperd/timeinfo/rngdates/begdate/text() != ''">
|
459
|
+
<field name="dct_temporal_sm">
|
460
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/rngdates/begdate, 1,4)"/>
|
461
|
+
<xsl:if test="substring(idinfo/timeperd/timeinfo/rngdates/begdate,1,4) != substring(idinfo/timeperd/timeinfo/rngdates/enddate,1,4)">
|
462
|
+
<xsl:text>-</xsl:text>
|
463
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/rngdates/enddate,1,4)"/>
|
464
|
+
</xsl:if>
|
465
|
+
</field>
|
466
|
+
</xsl:when>
|
467
|
+
</xsl:choose>
|
468
|
+
|
469
|
+
|
470
|
+
<!-- collection -->
|
471
|
+
<xsl:for-each select="idinfo/citation/citeinfo/lworkcit/citeinfo">
|
472
|
+
<field name="dct_isPartOf_sm">
|
473
|
+
<xsl:value-of select="title"/>
|
474
|
+
</field>
|
475
|
+
</xsl:for-each>
|
476
|
+
|
477
|
+
<!-- cross-references -->
|
478
|
+
<xsl:for-each select="idinfo/crossref/citeinfo">
|
479
|
+
<field name="dc_relation_sm">
|
480
|
+
<xsl:value-of select="title"/>
|
481
|
+
</field>
|
482
|
+
</xsl:for-each>
|
483
|
+
|
484
|
+
<field name="georss_polygon_s">
|
485
|
+
<xsl:text></xsl:text>
|
486
|
+
<xsl:value-of select="$y1"/>
|
487
|
+
<xsl:text> </xsl:text>
|
488
|
+
<xsl:value-of select="$x1"/>
|
489
|
+
<xsl:text> </xsl:text>
|
490
|
+
<xsl:value-of select="$y2"/>
|
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
|
+
<xsl:text> </xsl:text>
|
498
|
+
<xsl:value-of select="$y1"/>
|
499
|
+
<xsl:text> </xsl:text>
|
500
|
+
<xsl:value-of select="$x2"/>
|
501
|
+
<xsl:text> </xsl:text>
|
502
|
+
<xsl:value-of select="$y1"/>
|
503
|
+
<xsl:text> </xsl:text>
|
504
|
+
<xsl:value-of select="$x1"/>
|
505
|
+
</field>
|
506
|
+
|
507
|
+
<field name="solr_geom">
|
508
|
+
<xsl:text>ENVELOPE((</xsl:text>
|
509
|
+
<xsl:value-of select="$x1"/>
|
510
|
+
<xsl:text> </xsl:text>
|
511
|
+
<xsl:value-of select="$y1"/>
|
512
|
+
<xsl:text>, </xsl:text>
|
513
|
+
<xsl:value-of select="$x2"/>
|
514
|
+
<xsl:text> </xsl:text>
|
515
|
+
<xsl:value-of select="$y1"/>
|
516
|
+
<xsl:text>, </xsl:text>
|
517
|
+
<xsl:value-of select="$x2"/>
|
518
|
+
<xsl:text> </xsl:text>
|
519
|
+
<xsl:value-of select="$y2"/>
|
520
|
+
<xsl:text>, </xsl:text>
|
521
|
+
<xsl:value-of select="$x1"/>
|
522
|
+
<xsl:text> </xsl:text>
|
523
|
+
<xsl:value-of select="$y2"/>
|
524
|
+
<xsl:text>, </xsl:text>
|
525
|
+
<xsl:value-of select="$x1"/>
|
526
|
+
<xsl:text> </xsl:text>
|
527
|
+
<xsl:value-of select="$y1"/>
|
528
|
+
<xsl:text>))</xsl:text>
|
529
|
+
</field>
|
530
|
+
|
531
|
+
<field name="georss_box_s">
|
532
|
+
<xsl:value-of select="$y1"/>
|
533
|
+
<xsl:text> </xsl:text>
|
534
|
+
<xsl:value-of select="$x1"/>
|
535
|
+
<xsl:text> </xsl:text>
|
536
|
+
<xsl:value-of select="$y2"/>
|
537
|
+
<xsl:text> </xsl:text>
|
538
|
+
<xsl:value-of select="$x2"/>
|
539
|
+
</field>
|
540
|
+
|
541
|
+
|
542
|
+
<field name="solr_bbox">
|
543
|
+
<xsl:value-of select="$x1"/>
|
544
|
+
<xsl:text> </xsl:text>
|
545
|
+
<xsl:value-of select="$y1"/>
|
546
|
+
<xsl:text> </xsl:text>
|
547
|
+
<xsl:value-of select="$x2"/>
|
548
|
+
<xsl:text> </xsl:text>
|
549
|
+
<xsl:value-of select="$y2"/>
|
550
|
+
</field>
|
551
|
+
|
552
|
+
<field name="solr_sw_pt">
|
553
|
+
<xsl:value-of select="$y1"/>
|
554
|
+
<xsl:text>,</xsl:text>
|
555
|
+
<xsl:value-of select="$x1"/>
|
556
|
+
</field>
|
557
|
+
|
558
|
+
<field name="solr_ne_pt">
|
559
|
+
<xsl:value-of select="$y2"/>
|
560
|
+
<xsl:text>,</xsl:text>
|
561
|
+
<xsl:value-of select="$x2"/>
|
562
|
+
</field>
|
563
|
+
|
564
|
+
<!-- content date: singular, or beginning date of range: YYYY -->
|
565
|
+
|
566
|
+
<xsl:choose>
|
567
|
+
<xsl:when test="idinfo/timeperd/timeinfo/sngdate/caldate">
|
568
|
+
<field name="solr_year_i">
|
569
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/sngdate/caldate,1,4)"/>
|
570
|
+
</field>
|
571
|
+
</xsl:when>
|
572
|
+
<xsl:when test="idinfo/timeperd/timeinfo/mdattim/sngdate/caldate">
|
573
|
+
<field name="solr_year_i">
|
574
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/mdattim/sngdate/caldate,1,4)"/>
|
575
|
+
</field>
|
576
|
+
</xsl:when>
|
577
|
+
<xsl:when test="idinfo/timeperd/timeinfo/rngdates/begdate/text() != ''">
|
578
|
+
<field name="solr_year_i">
|
579
|
+
<xsl:value-of select="substring(idinfo/timeperd/timeinfo/rngdates/begdate, 1,4)"/>
|
580
|
+
</field>
|
581
|
+
</xsl:when>
|
582
|
+
</xsl:choose>
|
583
|
+
|
584
|
+
</doc>
|
585
|
+
</add>
|
586
|
+
</xsl:template>
|
587
|
+
|
588
|
+
</xsl:stylesheet>
|