geoblacklight-schema 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/LICENSE +14 -0
  4. data/README.md +44 -0
  5. data/bin/fgdc2mods.rb +5 -0
  6. data/bin/mods2geoblacklight.rb +5 -0
  7. data/bin/xsltproc-saxon +14 -0
  8. data/conf/protwords.txt +21 -0
  9. data/conf/schema.xml +158 -0
  10. data/conf/solrconfig.xml +160 -0
  11. data/conf/stopwords_en.txt +34 -0
  12. data/conf/synonyms.txt +29 -0
  13. data/examples/Gemfile +4 -0
  14. data/examples/generate-example-doc.rb +42 -0
  15. data/examples/selected.json +5787 -0
  16. data/examples/upload-to-solr.rb +50 -0
  17. data/geoblacklight-schema.gemspec +23 -0
  18. data/lib/geoblacklight/gazetteer.csv +1011 -0
  19. data/lib/geoblacklight/gazetteer.rb +104 -0
  20. data/lib/xslt/arcgis_to_iso19110.xsl +364 -0
  21. data/lib/xslt/fgdc2mods.xsl +1007 -0
  22. data/lib/xslt/iso2mods.xsl +939 -0
  23. data/lib/xslt/mods2geoblacklight.xsl +268 -0
  24. data/lib/xslt/mods2ogp.xsl +195 -0
  25. data/tools/fgdc2html/Gemfile +2 -0
  26. data/tools/fgdc2html/fgdc2html.css +71 -0
  27. data/tools/fgdc2html/fgdc2html.js +6 -0
  28. data/tools/fgdc2html/fgdc2html.xsl +1034 -0
  29. data/tools/fgdc2html/render.rb +30 -0
  30. data/tools/iso2html/Gemfile +2 -0
  31. data/tools/iso2html/iso-html.xsl +1745 -0
  32. data/tools/iso2html/render.rb +24 -0
  33. data/tools/iso2html/utils/convert-enumerations.xsl +97 -0
  34. data/tools/iso2html/utils/convert-latlong.xsl +73 -0
  35. data/tools/iso2html/utils/decode-uri/base.css +408 -0
  36. data/tools/iso2html/utils/decode-uri/index.html +29 -0
  37. data/tools/iso2html/utils/elements-fgdc.xml +824 -0
  38. data/tools/iso2html/utils/elements-iso.xml +636 -0
  39. data/tools/iso2html/utils/printFormatted.xsl +267 -0
  40. data/tools/iso2html/utils/printTextLines.xsl +192 -0
  41. data/tools/iso2html/utils/replace-newlines.xsl +97 -0
  42. data/tools/iso2html/utils/replace-string.xsl +80 -0
  43. data/tools/iso2html/utils/strip-digits.xsl +60 -0
  44. data/tools/iso2html/utils/url-decode.xsl +87 -0
  45. data/tools/iso2html/utils/wrap-text.xsl +174 -0
  46. data/tools/ogp/0_download.rb +96 -0
  47. data/tools/ogp/1_validate.rb +225 -0
  48. data/tools/ogp/2_transform.rb +438 -0
  49. data/tools/ogp/3_stanford.rb +35 -0
  50. data/tools/ogp/4_select.rb +189 -0
  51. data/tools/ogp/5_ingest.rb +55 -0
  52. data/tools/ogp/Gemfile +2 -0
  53. data/tools/solr/Gemfile +3 -0
  54. data/tools/solr/purge.rb +33 -0
  55. data/tools/solr/upload.rb +35 -0
  56. data/vendor/.keep +0 -0
  57. metadata +131 -0
@@ -0,0 +1,939 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ geo2mods.xsl - Transformation from ISO 19139 XML into MODS v3
4
+
5
+
6
+ Copyright 2013-2014, The Board of Trustees of the Leland Stanford Junior University
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+
21
+ Created by Kim Durante and Darren Hardy, Stanford University Libraries
22
+
23
+ Requires parameters:
24
+ * geometryType: One of Point, LineString, Polygon, Curve, or Grid (Raster).
25
+ see
26
+ http://www.schemacentral.com/sc/niem21/t-gml32_GeometryPropertyType.html
27
+ * purl - e.g., http://purl.stanford.edu/aa111bb2222
28
+ * zipName - e.g., data.zip
29
+ * fileFormat - e.g., Shapefile, GeoTIFF, ArcGRID
30
+
31
+ TODO:
32
+ * Series statements may need work?
33
+ -->
34
+ <xsl:stylesheet
35
+ xmlns="http://www.loc.gov/mods/v3"
36
+ xmlns:gco="http://www.isotc211.org/2005/gco"
37
+ xmlns:gmi="http://www.isotc211.org/2005/gmi"
38
+ xmlns:gmd="http://www.isotc211.org/2005/gmd"
39
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
40
+ xmlns:gml="http://www.opengis.net/gml"
41
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
42
+ version="1.0" exclude-result-prefixes="gml gmd gco gmi xsl">
43
+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
44
+ <xsl:strip-space elements="*"/>
45
+ <xsl:param name="geometryType"/>
46
+ <xsl:param name="purl"/>
47
+ <xsl:param name="zipName" select="'data.zip'"/>
48
+ <!-- The coordinates value for MODS v3 is quite vague,
49
+ so we have a variety of formats:
50
+ GMD, WKT, WMS, GML, GeoRSS, MARC034, MARC255 (default)
51
+ -->
52
+ <xsl:param name="geoformat" select="'MARC255'"/>
53
+ <xsl:param name="fileIdentifier" select="''"/>
54
+ <xsl:variable name="format">
55
+ <xsl:choose>
56
+ <xsl:when test="contains(rdf:RDF/rdf:Description/gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'Raster Dataset')">
57
+ <xsl:text>image/tiff</xsl:text>
58
+ </xsl:when>
59
+ <xsl:when test="contains(rdf:RDF/rdf:Description/gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'GeoTIFF')">
60
+ <xsl:text>image/tiff</xsl:text>
61
+ </xsl:when>
62
+ <xsl:when test="contains(rdf:RDF/rdf:Description/gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name, 'Shapefile')">
63
+ <xsl:text>application/x-esri-shapefile</xsl:text>
64
+ </xsl:when>
65
+ </xsl:choose>
66
+ </xsl:variable>
67
+ <xsl:template match="/">
68
+ <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" version="3.4" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd">
69
+ <xsl:for-each select="/gmi:MI_Metadata|/gmd:MD_Metadata|//gmd:MD_Metadata">
70
+ <xsl:if test="gmd:fileIdentifier/gco:CharacterString/text()">
71
+ <xsl:variable name="fileIdentifier" select="."/>
72
+ </xsl:if>
73
+ <xsl:variable name="purl" select="gmd:dataSetURI"/>
74
+
75
+ <titleInfo>
76
+ <title>
77
+ <xsl:apply-templates select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title"/>
78
+ </title>
79
+ </titleInfo>
80
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:alternateTitle">
81
+ <titleInfo>
82
+ <title type="alternative">
83
+ <xsl:value-of select="."/>
84
+ </title>
85
+ </titleInfo>
86
+ </xsl:for-each>
87
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:alternateTitle">
88
+ <titleInfo>
89
+ <title displayLabel="Alternative title">
90
+ <xsl:value-of select="."/>
91
+ </title>
92
+ </titleInfo>
93
+ </xsl:for-each>
94
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='originator']">
95
+ <xsl:choose>
96
+ <xsl:when test="ancestor-or-self::*/gmd:individualName">
97
+ <name type="personal">
98
+ <namePart>
99
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
100
+ </namePart>
101
+ <role>
102
+ <!-- personal author -->
103
+ <roleTerm type="text" authority="marcrelator">creator</roleTerm>
104
+ </role>
105
+ </name>
106
+ </xsl:when>
107
+ <xsl:when test="ancestor-or-self::*/gmd:organisationName">
108
+ <name type="corporate">
109
+ <namePart>
110
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
111
+ </namePart>
112
+ <role>
113
+ <!-- corporate author -->
114
+ <roleTerm type="text" authority="marcrelator">creator</roleTerm>
115
+ </role>
116
+ </name>
117
+ </xsl:when>
118
+ </xsl:choose>
119
+ </xsl:for-each>
120
+
121
+ <!-- typeOfResource for SW - see http://www.loc.gov/standards/mods/v3/mods-userguide-elements.html -->
122
+ <typeOfResource>cartographic</typeOfResource>
123
+ <typeOfResource>software, multimedia</typeOfResource>
124
+ <genre>
125
+ <xsl:attribute name="authority">lcgft</xsl:attribute>
126
+ <xsl:attribute name="valueURI">http://id.loc.gov/authorities/genreForms/gf2011026297</xsl:attribute>
127
+ <xsl:text>Geospatial data</xsl:text>
128
+ </genre>
129
+ <genre>
130
+ <xsl:attribute name="authority">rdacontent</xsl:attribute>
131
+ <xsl:attribute name="valueURI">http://rdvocab.info/termList/RDAContentType/1001</xsl:attribute>
132
+ <xsl:text>cartographic dataset</xsl:text>
133
+ </genre>
134
+ <originInfo>
135
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='publisher']">
136
+ <publisher>
137
+ <xsl:choose>
138
+ <xsl:when test="ancestor-or-self::*/gmd:organisationName">
139
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
140
+ </xsl:when>
141
+ <xsl:when test="ancestor-or-self::*/gmd:individualName">
142
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
143
+ </xsl:when>
144
+ </xsl:choose>
145
+ </publisher>
146
+ <xsl:for-each select="ancestor-or-self::*/gmd:contactInfo">
147
+ <place>
148
+ <placeTerm type="text">
149
+ <xsl:value-of select="ancestor-or-self::*/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city"/>
150
+ <xsl:if test="ancestor-or-self::*/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city">, </xsl:if>
151
+ <xsl:value-of select="ancestor-or-self::*/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:administrativeArea"/>
152
+ <xsl:if test="ancestor-or-self::*/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:administrativeArea">, </xsl:if>
153
+ <xsl:value-of select="ancestor-or-self::*/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country"/>
154
+ </placeTerm>
155
+ </place>
156
+ </xsl:for-each>
157
+ </xsl:for-each>
158
+ <dateIssued encoding="w3cdtf" keyDate="yes">
159
+ <!-- strip MM-DD, oupput YYYY -->
160
+ <xsl:choose>
161
+ <xsl:when test="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date">
162
+ <xsl:value-of select="substring(gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date,1,4)"/>
163
+ </xsl:when>
164
+ <xsl:otherwise>unknown</xsl:otherwise>
165
+ </xsl:choose>
166
+ </dateIssued>
167
+
168
+
169
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
170
+ <xsl:if test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='temporal']">
171
+ <xsl:for-each select="gmd:keyword">
172
+
173
+ <xsl:choose>
174
+
175
+ <!-- 4 digit year -->
176
+ <xsl:when test="string-length()=4">
177
+ <dateValid>
178
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
179
+ <xsl:value-of select="."/>
180
+ </dateValid>
181
+ </xsl:when>
182
+
183
+ <!-- range of dates in YYYY-YYYY format -->
184
+
185
+ <xsl:when test="contains(./*,'-')">
186
+ <dateValid>
187
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
188
+ <xsl:attribute name="point">start</xsl:attribute>
189
+ <xsl:value-of select="substring-before(*,'-')"/>
190
+ </dateValid>
191
+ <dateValid>
192
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
193
+ <xsl:attribute name="point">end</xsl:attribute>
194
+ <xsl:value-of select="substring-after(*,'-')"/>
195
+ </dateValid>
196
+ </xsl:when>
197
+
198
+ <!-- other -->
199
+
200
+ <xsl:otherwise>
201
+ <dateValid>
202
+ <xsl:value-of select="."/>
203
+ </dateValid>
204
+ </xsl:otherwise>
205
+ </xsl:choose>
206
+ </xsl:for-each>
207
+ </xsl:if>
208
+ </xsl:for-each>
209
+
210
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:edition">
211
+ <edition>
212
+ <xsl:value-of select="."/>
213
+ </edition>
214
+ </xsl:for-each>
215
+ </originInfo>
216
+ <language>
217
+ <languageTerm authority="iso639-2b">
218
+ <xsl:value-of select="gmd:language/gmd:LanguageCode/@codeListValue"/>
219
+ </languageTerm>
220
+ </language>
221
+ <physicalDescription>
222
+ <form>
223
+ <xsl:apply-templates select="gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name"/>
224
+ </form>
225
+ <xsl:for-each select="gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:transferSize">
226
+ <extent>
227
+ <xsl:value-of select="gco:Real"/>
228
+ <xsl:if test="ancestor-or-self::*/gmd:MD_DigitalTransferOptions/gmd:unitsOfDistribution">
229
+ <xsl:text> </xsl:text>
230
+ <xsl:value-of select="ancestor-or-self::*/gmd:MD_DigitalTransferOptions/gmd:unitsOfDistribution"/>
231
+ </xsl:if>
232
+ </extent>
233
+
234
+ <!-- The digitalOrigin is coded here:
235
+ http://www.loc.gov/standards/mods/v3/mods-userguide-elements.html#digitalorigin
236
+ -->
237
+ </xsl:for-each>
238
+ <digitalOrigin>born digital</digitalOrigin>
239
+ </physicalDescription>
240
+ <subject>
241
+ <cartographics>
242
+ <xsl:choose>
243
+ <xsl:when test="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:spatialResolution">
244
+ <scale>
245
+ <xsl:text>1:</xsl:text>
246
+ <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:spatialResolution/gmd:MD_Resolution/gmd:equivalentScale/gmd:MD_RepresentativeFraction/gmd:denominator/gco:Integer"/>
247
+ </scale>
248
+ </xsl:when>
249
+ <xsl:otherwise>
250
+ <scale>
251
+ <xsl:text>Scale not given.</xsl:text>
252
+ </scale>
253
+ </xsl:otherwise>
254
+ </xsl:choose>
255
+ <projection>
256
+ <!-- Use '::' since the spec requires a version here (e.g., :7.4:) but it's generally left blank -->
257
+ <xsl:value-of select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString"/>
258
+ <xsl:text>::</xsl:text>
259
+ <xsl:value-of select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:code/gco:CharacterString"/>
260
+ </projection>
261
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox">
262
+ <coordinates>
263
+ <xsl:choose>
264
+ <xsl:when test="$geoformat = 'GMD'">
265
+ <gmd:EX_GeographicBoundingBox xmlns:gmd="http://www.isotc211.org/2005/gmd">
266
+ <gmd:westBoundLongitude>
267
+ <gco:Decimal>
268
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
269
+ </gco:Decimal>
270
+ </gmd:westBoundLongitude>
271
+ <gmd:eastBoundLongitude>
272
+ <gco:Decimal>
273
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
274
+ </gco:Decimal>
275
+ </gmd:eastBoundLongitude>
276
+ <gmd:southBoundLatitude>
277
+ <gco:Decimal>
278
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
279
+ </gco:Decimal>
280
+ </gmd:southBoundLatitude>
281
+ <gmd:northBoundLatitude>
282
+ <gco:Decimal>
283
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
284
+ </gco:Decimal>
285
+ </gmd:northBoundLatitude>
286
+ </gmd:EX_GeographicBoundingBox>
287
+ </xsl:when>
288
+ <!-- WKT is x y, x y
289
+
290
+ POLYGON((sw, nw, ne, se, sw))
291
+ -->
292
+ <xsl:when test="$geoformat = 'WKT'">
293
+ <xsl:text>POLYGON((</xsl:text>
294
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
295
+ <xsl:text> </xsl:text>
296
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
297
+ <xsl:text>, </xsl:text>
298
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
299
+ <xsl:text> </xsl:text>
300
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
301
+ <xsl:text>, </xsl:text>
302
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
303
+ <xsl:text> </xsl:text>
304
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
305
+ <xsl:text>, </xsl:text>
306
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
307
+ <xsl:text> </xsl:text>
308
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
309
+ <xsl:text>, </xsl:text>
310
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
311
+ <xsl:text> </xsl:text>
312
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
313
+ <xsl:text>))</xsl:text>
314
+ </xsl:when>
315
+ <xsl:when test="$geoformat = 'WMS'">
316
+ <!-- WMS
317
+ Uses min/max as attributes
318
+
319
+ Example:
320
+
321
+ <wms:BoundingBox xmlns:wms="http://www.opengis.net/wms"
322
+ CRS="EPSG:4326"
323
+ minx="-97.119945" miny="25.467075"
324
+ maxx="-82.307619" maxy="30.665492"/>
325
+ -->
326
+ <wms:BoundingBox xmlns:wms="http://www.opengis.net/wms">
327
+ <xsl:attribute name="CRS">EPSG:4326</xsl:attribute>
328
+ <xsl:attribute name="minx">
329
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
330
+ </xsl:attribute>
331
+ <xsl:attribute name="miny">
332
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
333
+ </xsl:attribute>
334
+ <xsl:attribute name="maxx">
335
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
336
+ </xsl:attribute>
337
+ <xsl:attribute name="maxy">
338
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
339
+ </xsl:attribute>
340
+ </wms:BoundingBox>
341
+ </xsl:when>
342
+ <xsl:when test="$geoformat = 'GML'">
343
+ <!-- GML
344
+ Using SW and NE corners in (x, y) coordinates
345
+
346
+ Example:
347
+
348
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml/3.2" srsName="EPSG:4326">
349
+ <gml:lowerCorner>-97.119945 25.467075</gml:lowerCorner>
350
+ <gml:upperCorner>-82.307619 30.665492</gml:upperCorner>
351
+ </gml:Envelope>
352
+ -->
353
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml/3.2">
354
+ <xsl:attribute name="srsName">
355
+ <xsl:value-of select="//gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString"/>
356
+ <xsl:text>:</xsl:text>
357
+ <xsl:value-of select="//gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:code/gco:CharacterString"/>
358
+ </xsl:attribute>
359
+ <gml:lowerCorner>
360
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
361
+ <xsl:text> </xsl:text>
362
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
363
+ </gml:lowerCorner>
364
+ <gml:upperCorner>
365
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
366
+ <xsl:text> </xsl:text>
367
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
368
+ </gml:upperCorner>
369
+ </gml:Envelope>
370
+ </xsl:when>
371
+ <xsl:when test="$geoformat = 'GeoRSS'">
372
+ <!-- GeoRSS:
373
+ Rectangular envelope property element containing two pairs of coordinates
374
+ (lower left envelope corner, upper right envelope corner) representing
375
+ latitude then longitude in the WGS84 coordinate reference system.
376
+
377
+ Example:
378
+
379
+ <georss:box>42.943 -71.032 43.039 -69.856</georss:box>
380
+ -->
381
+ <georss:box xmlns:georss="http://www.georss.org/georss">
382
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
383
+ <xsl:text> </xsl:text>
384
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
385
+ <xsl:text> </xsl:text>
386
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
387
+ <xsl:text> </xsl:text>
388
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
389
+ </georss:box>
390
+ </xsl:when>
391
+ <xsl:when test="$geoformat = 'MARC034'">
392
+ <!-- MARC 034
393
+ Subfields $d, $e, $f, and $g always appear together. The coordinates
394
+ may be recorded in the form hdddmmss (hemisphere-degrees-minutes-seconds),
395
+ however, other forms are also allowed, such as decimal degrees.
396
+ The subelements are each right justified and unused positions contain zeros.
397
+
398
+ $d - Coordinates - westernmost longitude (NR)
399
+ $e - Coordinates - easternmost longitude (NR)
400
+ $f - Coordinates - northernmost latitude (NR)
401
+ $g - Coordinates - southernmost latitude (NR)
402
+
403
+ Example:
404
+
405
+ $d-097.119945$e-082.307619$f+30.665492$g+25.467075
406
+
407
+ See http://www.w3.org/TR/1999/REC-xslt-19991116#format-number
408
+ -->
409
+ <xsl:text>$d</xsl:text>
410
+ <xsl:value-of select="format-number(gmd:westBoundLongitude/gco:Decimal, '+000.000000;-000.000000')"/>
411
+ <xsl:text>$e</xsl:text>
412
+ <xsl:value-of select="format-number(gmd:eastBoundLongitude/gco:Decimal, '+000.000000;-000.000000')"/>
413
+ <xsl:text>$f</xsl:text>
414
+ <xsl:value-of select="format-number(gmd:northBoundLatitude/gco:Decimal, '+00.000000;-00.000000')"/>
415
+ <xsl:text>$g</xsl:text>
416
+ <xsl:value-of select="format-number(gmd:southBoundLatitude/gco:Decimal, '+00.000000;-00.000000')"/>
417
+ </xsl:when>
418
+ <xsl:otherwise>
419
+ <!-- MARC 255 $c:
420
+ Coordinates are recorded in the order of
421
+ westernmost longitude, easternmost longitude,
422
+ northernmost latitude, and southernmost latitude,
423
+ and separated with double-hyphen and / characters.
424
+
425
+ XXX: Note that this leaves the coordinates in decimal
426
+ degrees whereas 255c suggests deg-min-sec.
427
+
428
+ Example:
429
+
430
+ -97.119945 &#x002D;&#x002D; -82.307619/30.665492 &#x002D;&#x002D; 25.467075
431
+
432
+ See http://www.loc.gov/marc/bibliographic/bd255.html $c
433
+ -->
434
+ <xsl:value-of select="gmd:westBoundLongitude/gco:Decimal"/>
435
+ <xsl:text> -- </xsl:text>
436
+ <xsl:value-of select="gmd:eastBoundLongitude/gco:Decimal"/>
437
+ <xsl:text>/</xsl:text>
438
+ <xsl:value-of select="gmd:northBoundLatitude/gco:Decimal"/>
439
+ <xsl:text> -- </xsl:text>
440
+ <xsl:value-of select="gmd:southBoundLatitude/gco:Decimal"/>
441
+ </xsl:otherwise>
442
+ </xsl:choose>
443
+ </coordinates>
444
+ </xsl:for-each>
445
+ </cartographics>
446
+ </subject>
447
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract">
448
+ <abstract displayLabel="Abstract">
449
+ <xsl:attribute name="lang">eng</xsl:attribute>
450
+ <xsl:value-of select="gco:CharacterString"/>
451
+ </abstract>
452
+ </xsl:for-each>
453
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:purpose">
454
+ <abstract displayLabel="Purpose">
455
+ <xsl:attribute name="lang">eng</xsl:attribute>
456
+ <xsl:value-of select="gco:CharacterString"/>
457
+ </abstract>
458
+ </xsl:for-each>
459
+ <!-- Reports, citation, other info, etc. -->
460
+ <xsl:for-each select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_ConceptualConsistency/gmd:evaluationMethodDescription">
461
+ <note displayLabel="Conceptual consistency report">
462
+ <xsl:attribute name="lang">eng</xsl:attribute>
463
+ <xsl:value-of select="gco:CharacterString"/>
464
+ </note>
465
+ </xsl:for-each>
466
+ <xsl:for-each select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_AbsoluteExternalPositionalAccuracy/gmd:evaluationMethodDescription">
467
+ <note displayLabel="Attribute accuracy report">
468
+ <xsl:attribute name="lang">eng</xsl:attribute>
469
+ <xsl:value-of select="gco:CharacterString"/>
470
+ </note>
471
+ </xsl:for-each>
472
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:credit">
473
+ <note displayLabel="Preferred citation">
474
+ <xsl:attribute name="lang">eng</xsl:attribute>
475
+ <xsl:value-of select="gco:CharacterString"/>
476
+ <xsl:text> Available at: </xsl:text>
477
+ <xsl:value-of select="$purl"/>
478
+ </note>
479
+ </xsl:for-each>
480
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:supplementalInformation">
481
+ <note displayLabel="Supplemental information">
482
+ <xsl:value-of select="gco:CharacterString"/>
483
+ </note>
484
+ </xsl:for-each>
485
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_Constraints">
486
+ <xsl:for-each select="gmd:useLimitation">
487
+ <note displayLabel="Use limitation">
488
+ <xsl:value-of select="gco:CharacterString"/>
489
+ </note>
490
+ </xsl:for-each>
491
+ </xsl:for-each>
492
+ <!-- MODS relatedItem type='host' added through RELS-EXT-
493
+
494
+
495
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:associationType/gmd:DS_AssociationTypeCode[@codeListValue='largerWorkCitation']">
496
+ <relatedItem>
497
+ <xsl:attribute name="type">host</xsl:attribute>
498
+ <titleInfo>
499
+ <title>
500
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:title"/>
501
+ </title>
502
+ </titleInfo>
503
+ <xsl:if test="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code">
504
+ <location>
505
+ <url>
506
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code"/>
507
+ </url>
508
+ </location>
509
+ </xsl:if>
510
+ <xsl:for-each select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='originator']">
511
+ <xsl:if test="ancestor-or-self::*/gmd:individualName">
512
+ <name type="personal">
513
+ <namePart>
514
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
515
+ </namePart>
516
+ </name>
517
+ </xsl:if>
518
+ <xsl:if test="ancestor-or-self::*/gmd:organisationName">
519
+ <name type="corporate">
520
+ <namePart>
521
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
522
+ </namePart>
523
+ </name>
524
+ </xsl:if>
525
+ </xsl:for-each>
526
+ <originInfo>
527
+ <xsl:for-each select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='publisher']">
528
+ <xsl:if test="ancestor-or-self::*/gmd:individualName">
529
+ <publisher>
530
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
531
+ </publisher>
532
+ </xsl:if>
533
+ <xsl:if test="ancestor-or-self::*/gmd:organisationName">
534
+ <publisher>
535
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
536
+ </publisher>
537
+ </xsl:if>
538
+ </xsl:for-each>
539
+ <dateIssued encoding="w3cdtf">
540
+
541
+ <xsl:choose>
542
+ <xsl:when test="ancestor-or-self::*/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:date">
543
+ <xsl:value-of select="substring(ancestor-or-self::*/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date,1,4)"/>
544
+ </xsl:when>
545
+ <xsl:otherwise>unknown</xsl:otherwise>
546
+ </xsl:choose>
547
+ </dateIssued>
548
+ <xsl:for-each select="ancestor-or-self::*/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:edition">
549
+ <edition>
550
+ <xsl:value-of select="."/>
551
+ </edition>
552
+ </xsl:for-each>
553
+ </originInfo>
554
+ </relatedItem>
555
+ </xsl:for-each> -->
556
+
557
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:associationType/gmd:DS_AssociationTypeCode[@codeListValue='crossReference']">
558
+ <relatedItem>
559
+ <xsl:attribute name="type">isReferencedBy</xsl:attribute>
560
+ <titleInfo>
561
+ <title>
562
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:title"/>
563
+ </title>
564
+ </titleInfo>
565
+ <xsl:if test="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code">
566
+ <location>
567
+ <url>
568
+ <xsl:value-of select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code"/>
569
+ </url>
570
+ </location>
571
+ </xsl:if>
572
+ <xsl:for-each select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='originator']">
573
+ <xsl:if test="ancestor-or-self::*/gmd:individualName">
574
+ <name type="personal">
575
+ <namePart>
576
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
577
+ </namePart>
578
+ </name>
579
+ </xsl:if>
580
+ <xsl:if test="ancestor-or-self::*/gmd:organisationName">
581
+ <name type="corporate">
582
+ <namePart>
583
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
584
+ </namePart>
585
+ </name>
586
+ </xsl:if>
587
+ </xsl:for-each>
588
+
589
+ <originInfo>
590
+ <xsl:for-each select="ancestor-or-self::*/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty/gmd:role/gmd:CI_RoleCode[@codeListValue='publisher']">
591
+ <xsl:if test="ancestor-or-self::*/gmd:individualName">
592
+ <publisher>
593
+ <xsl:value-of select="ancestor-or-self::*/gmd:individualName"/>
594
+ </publisher>
595
+ </xsl:if>
596
+ <xsl:if test="ancestor-or-self::*/gmd:organisationName">
597
+ <publisher>
598
+ <xsl:value-of select="ancestor-or-self::*/gmd:organisationName"/>
599
+ </publisher>
600
+ </xsl:if>
601
+ </xsl:for-each>
602
+ <dateIssued encoding="w3cdtf">
603
+ <!-- strip MM-DD, oupput YYYY -->
604
+ <xsl:choose>
605
+ <xsl:when test="ancestor-or-self::*/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:date">
606
+ <xsl:value-of select="substring(ancestor-or-self::*/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date,1,4)"/>
607
+ </xsl:when>
608
+ <xsl:otherwise>unknown</xsl:otherwise>
609
+ </xsl:choose>
610
+ </dateIssued>
611
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:aggregationInfo/gmd:MD_AggregateInformation/gmd:aggregateDataSetName/gmd:CI_Citation/gmd:edition">
612
+ <edition>
613
+ <xsl:value-of select="."/>
614
+ </edition>
615
+ </xsl:for-each>
616
+ </originInfo>
617
+ </relatedItem>
618
+ </xsl:for-each>
619
+
620
+ <!-- subjects: topic, geographic, temporal, ISO19115TopicCategory -->
621
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
622
+ <xsl:if test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='theme']">
623
+ <xsl:for-each select="gmd:keyword">
624
+ <subject>
625
+ <topic>
626
+ <xsl:if test="ancestor-or-self::*/gmd:thesaurusName/gmd:CI_Citation/gmd:title">
627
+ <xsl:attribute name="authority">
628
+ <!-- TODO: Should be case-insenstive compare -->
629
+ <xsl:choose>
630
+ <xsl:when test="ancestor-or-self::*/gmd:thesaurusName/gmd:CI_Citation/gmd:title='Library of Congress Subject Headings (LCSH)'">
631
+ <xsl:text>lcsh</xsl:text>
632
+ </xsl:when>
633
+ <xsl:otherwise>
634
+ <xsl:value-of select="ancestor-or-self::*/gmd:thesaurusName/gmd:CI_Citation/gmd:title"/>
635
+ </xsl:otherwise>
636
+ </xsl:choose>
637
+ </xsl:attribute>
638
+ </xsl:if>
639
+ <xsl:if test="ancestor-or-self::*/gmd:thesaurusName/gmd:CI_Citation/gmd:identifier">
640
+ <xsl:attribute name="authorityURI">
641
+ <xsl:value-of select="ancestor-or-self::*/gmd:thesaurusName/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code"/>
642
+ </xsl:attribute>
643
+ </xsl:if>
644
+ <xsl:attribute name="lang">
645
+ <xsl:value-of select="../../../../../gmd:language/gmd:LanguageCode"/>
646
+ </xsl:attribute>
647
+ <xsl:value-of select="."/>
648
+ </topic>
649
+ </subject>
650
+ </xsl:for-each>
651
+ </xsl:if>
652
+ </xsl:for-each>
653
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
654
+ <xsl:if test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='place']">
655
+ <xsl:for-each select="gmd:keyword">
656
+ <subject>
657
+ <geographic>
658
+ <!-- adds geonames info through external process -->
659
+ <xsl:attribute name="lang">
660
+ <xsl:value-of select="../../../../../gmd:language/gmd:LanguageCode"/>
661
+ </xsl:attribute>
662
+ <xsl:value-of select="."/>
663
+ </geographic>
664
+ </subject>
665
+ </xsl:for-each>
666
+ </xsl:if>
667
+ </xsl:for-each>
668
+
669
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
670
+ <xsl:if test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='temporal']">
671
+ <xsl:for-each select="gmd:keyword">
672
+
673
+ <xsl:choose>
674
+
675
+ <!-- 4 digit year -->
676
+ <xsl:when test="string-length()=4">
677
+ <subject>
678
+ <temporal>
679
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
680
+ <xsl:value-of select="."/>
681
+ </temporal>
682
+ </subject>
683
+ </xsl:when>
684
+
685
+ <!-- range of dates in YYYY-YYYY format -->
686
+
687
+ <xsl:when test="contains(./*,'-')">
688
+ <subject>
689
+ <temporal>
690
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
691
+ <xsl:attribute name="point">start</xsl:attribute>
692
+ <xsl:value-of select="substring-before(*,'-')"/>
693
+ </temporal>
694
+ <temporal>
695
+ <xsl:attribute name="encoding">w3cdtf</xsl:attribute>
696
+ <xsl:attribute name="point">end</xsl:attribute>
697
+ <xsl:value-of select="substring-after(*,'-')"/>
698
+ </temporal>
699
+ </subject>
700
+ </xsl:when>
701
+
702
+ <!-- other -->
703
+
704
+ <xsl:otherwise>
705
+ <subject>
706
+ <temporal>
707
+ <xsl:value-of select="."/>
708
+ </temporal>
709
+ </subject>
710
+ </xsl:otherwise>
711
+
712
+ </xsl:choose>
713
+ </xsl:for-each>
714
+ </xsl:if>
715
+ </xsl:for-each>
716
+
717
+
718
+
719
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode">
720
+ <subject>
721
+ <topic>
722
+ <xsl:attribute name="authority">ISO19115TopicCategory</xsl:attribute>
723
+
724
+ <!-- kd: do we need authorityURI? -->
725
+ <xsl:attribute name="authorityURI">
726
+ <xsl:text>http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode</xsl:text>
727
+ </xsl:attribute>
728
+ <xsl:attribute name="valueURI">
729
+ <xsl:choose>
730
+ <xsl:when test="contains(.,'farming')">
731
+ <xsl:value-of select="."/>
732
+ </xsl:when>
733
+ <xsl:when test="contains(.,'biota')">
734
+ <xsl:value-of select="."/>
735
+ </xsl:when>
736
+ <xsl:when test="contains(.,'climatologyMeteorologyAtmosphere')">
737
+ <xsl:value-of select="."/>
738
+ </xsl:when>
739
+ <xsl:when test="contains(.,'boundaries')">
740
+ <xsl:value-of select="."/>
741
+ </xsl:when>
742
+ <xsl:when test="contains(.,'elevation')">
743
+ <xsl:value-of select="."/>
744
+ </xsl:when>
745
+ <xsl:when test="contains(.,'environment')">
746
+ <xsl:value-of select="."/>
747
+ </xsl:when>
748
+ <xsl:when test="contains(.,'health')">
749
+ <xsl:value-of select="."/>
750
+ </xsl:when>
751
+ <xsl:when test="contains(.,'imageryBaseMapsEarthCover')">
752
+ <xsl:value-of select="."/>
753
+ </xsl:when>
754
+ <xsl:when test="contains(.,'intelligenceMilitary')">
755
+ <xsl:value-of select="."/>
756
+ </xsl:when>
757
+ <xsl:when test="contains(.,'inlandWaters')">
758
+ <xsl:value-of select="."/>
759
+ </xsl:when>
760
+ <xsl:when test="contains(.,'location')">
761
+ <xsl:value-of select="."/>
762
+ </xsl:when>
763
+ <xsl:when test="contains(.,'oceans')">
764
+ <xsl:value-of select="."/>
765
+ </xsl:when>
766
+ <xsl:when test="contains(.,'planningCadastre')">
767
+ <xsl:value-of select="."/>
768
+ </xsl:when>
769
+ <xsl:when test="contains(.,'utilitiesCommunication')">
770
+ <xsl:value-of select="."/>
771
+ </xsl:when>
772
+ <xsl:when test="contains(.,'structure')">
773
+ <xsl:value-of select="."/>
774
+ </xsl:when>
775
+ <xsl:when test="contains(.,'transportation')">
776
+ <xsl:value-of select="."/>
777
+ </xsl:when><xsl:when test="contains(.,'society')">
778
+ <xsl:value-of select="."/>
779
+ </xsl:when>
780
+ </xsl:choose>
781
+ </xsl:attribute>
782
+ <xsl:choose>
783
+ <xsl:when test="contains(.,'farming')">
784
+
785
+ <xsl:text>Farming</xsl:text>
786
+ </xsl:when>
787
+ <xsl:when test="contains(.,'biota')">
788
+
789
+ <xsl:text>Biology and Ecology</xsl:text>
790
+ </xsl:when>
791
+ <xsl:when test="contains(.,'climatologyMeteorologyAtmosphere')">
792
+ <xsl:text>Climatology, Meteorology and Atmosphere</xsl:text>
793
+ </xsl:when>
794
+ <xsl:when test="contains(.,'boundaries')">
795
+ <xsl:text>Boundaries</xsl:text>
796
+ </xsl:when>
797
+ <xsl:when test="contains(.,'elevation')">
798
+ <xsl:text>Elevation</xsl:text>
799
+ </xsl:when>
800
+ <xsl:when test="contains(.,'environment')">
801
+ <xsl:text>Environment</xsl:text>
802
+ </xsl:when>
803
+ <xsl:when test="contains(.,'geoscientificInformation')">
804
+ <xsl:text>Geoscientific Information</xsl:text>
805
+ </xsl:when>
806
+ <xsl:when test="contains(.,'health')">
807
+ <xsl:text>Health</xsl:text>
808
+ </xsl:when>
809
+ <xsl:when test="contains(.,'imageryBaseMapsEarthCover')">
810
+ <xsl:text>Imagery and Base Maps</xsl:text>
811
+ </xsl:when>
812
+ <xsl:when test="contains(.,'intelligenceMilitary')">
813
+ <xsl:text>Military</xsl:text>
814
+ </xsl:when>
815
+ <xsl:when test="contains(.,'inlandWaters')">
816
+ <xsl:text>Inland Waters</xsl:text>
817
+ </xsl:when>
818
+ <xsl:when test="contains(.,'location')">
819
+ <xsl:text>Location</xsl:text>
820
+ </xsl:when>
821
+ <xsl:when test="contains(.,'oceans')">
822
+ <xsl:text>Oceans</xsl:text>
823
+ </xsl:when>
824
+ <xsl:when test="contains(.,'planningCadastre')">
825
+ <xsl:text>Planning and Cadastral</xsl:text>
826
+ </xsl:when>
827
+ <xsl:when test="contains(.,'structure')">
828
+ <xsl:text>Structure</xsl:text>
829
+ </xsl:when>
830
+ <xsl:when test="contains(.,'transportation')">
831
+ <xsl:text>Transportation</xsl:text>
832
+ </xsl:when>
833
+ <xsl:when test="contains(.,'utilitiesCommunication')">
834
+ <xsl:text>Utilities and Communication</xsl:text>
835
+ </xsl:when>
836
+ <xsl:when test="contains(.,'society')">
837
+ <xsl:text>Society</xsl:text>
838
+ </xsl:when>
839
+ </xsl:choose>
840
+ </topic>
841
+ </subject>
842
+ </xsl:for-each>
843
+
844
+
845
+ <location>
846
+ <url>
847
+ <xsl:value-of select="$purl"/>
848
+ </url>
849
+ </location>
850
+
851
+ <!-- access rights to be mapped from restrictionCode/otherRestrictions/APO -->
852
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints">
853
+ <accessCondition type="useAndReproduction">
854
+ <xsl:value-of select=". "/>
855
+ </accessCondition>
856
+ </xsl:for-each>
857
+
858
+ <!-- recordInfo -->
859
+
860
+
861
+ <recordInfo>
862
+ <recordContentSource>
863
+ <xsl:text>Stanford</xsl:text>
864
+ </recordContentSource>
865
+ <recordIdentifier>
866
+ <xsl:value-of select="gmd:fileIdentifier"/>
867
+ </recordIdentifier>
868
+ <recordOrigin>This record was translated from ISO 19139 to MODS v.3 using an xsl transformation.</recordOrigin>
869
+ <languageOfCataloging>
870
+ <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
871
+ </languageOfCataloging>
872
+ </recordInfo>
873
+
874
+
875
+ <!-- Output geo extension to MODS -->
876
+ <xsl:if test="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox">
877
+ <extension displayLabel="geo" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
878
+ <rdf:RDF xmlns:gml="http://www.opengis.net/gml/3.2/" xmlns:dc="http://purl.org/dc/elements/1.1/">
879
+ <rdf:Description>
880
+ <xsl:attribute name="rdf:about">
881
+ <xsl:value-of select="$purl"/>
882
+ </xsl:attribute>
883
+ <!-- Output MIME type -->
884
+ <dc:format>
885
+ <xsl:value-of select="$format"/>
886
+ <xsl:text>; format=</xsl:text>
887
+ <xsl:value-of select="$fileFormat"/>
888
+ </dc:format>
889
+ <!-- Output Dataset# point, linestring, polygon, raster, etc. -->
890
+ <dc:type>
891
+ <xsl:text>Dataset#</xsl:text>
892
+ <xsl:value-of select="$geometryType"/>
893
+ </dc:type>
894
+ <!-- Output bounding box -->
895
+ <gml:boundedBy>
896
+ <gml:Envelope>
897
+ <xsl:attribute name="gml:srsName">
898
+ <xsl:value-of select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString"/>
899
+ <xsl:text>:</xsl:text>
900
+ <xsl:value-of select="gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:code/gco:CharacterString"/>
901
+ </xsl:attribute>
902
+ <gml:lowerCorner>
903
+ <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal"/>
904
+ <xsl:text> </xsl:text>
905
+ <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal"/>
906
+ </gml:lowerCorner>
907
+ <gml:upperCorner>
908
+ <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal"/>
909
+ <xsl:text> </xsl:text>
910
+ <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal"/>
911
+ </gml:upperCorner>
912
+ </gml:Envelope>
913
+ </gml:boundedBy>
914
+ <!-- Output linked data to GeoNames: An external process will clean these up -->
915
+ <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords">
916
+ <xsl:if test="gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='place']">
917
+ <xsl:for-each select="gmd:keyword">
918
+ <dc:coverage>
919
+ <xsl:attribute name="rdf:resource">
920
+ <xsl:value-of select="../../@xlink:href"/>
921
+ </xsl:attribute>
922
+ <xsl:attribute name="dc:language">
923
+ <xsl:value-of select="../../../../../gmd:language/gmd:LanguageCode"/>
924
+ </xsl:attribute>
925
+ <xsl:attribute name="dc:title">
926
+ <xsl:value-of select="."/>
927
+ </xsl:attribute>
928
+ </dc:coverage>
929
+ </xsl:for-each>
930
+ </xsl:if>
931
+ </xsl:for-each>
932
+ </rdf:Description>
933
+ </rdf:RDF>
934
+ </extension>
935
+ </xsl:if>
936
+ </xsl:for-each>
937
+ </mods>
938
+ </xsl:template>
939
+ </xsl:stylesheet>