Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Add complete FGDC to MODS mapping
Browse files Browse the repository at this point in the history
Closes #70.
  • Loading branch information
Mike Graves committed Oct 28, 2015
1 parent 26f50bd commit 22525a0
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
.tox
docs/_build
instance
.cache
55 changes: 46 additions & 9 deletions kepler/templates/fgdc_to_mods.xslt
Expand Up @@ -4,20 +4,15 @@
xmlns:mods="http://www.loc.gov/mods/v3">
<xsl:output omit-xml-declaration="yes" />

<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

<xsl:template match="/">
<mods:mods>
<xsl:apply-templates select="metadata" />
</mods:mods>
</xsl:template>

<xsl:template match="idinfo">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="citation">
<xsl:apply-templates select="citeinfo" />
</xsl:template>

<xsl:template match="title">
<mods:titleInfo>
<mods:title><xsl:value-of select="." /></mods:title>
Expand All @@ -26,10 +21,52 @@

<xsl:template match="origin">
<mods:name>
<mods:namePart><xsl:value-of select="." /></mods:namePart>
<mods:displayForm><xsl:value-of select="." /></mods:displayForm>
</mods:name>
</xsl:template>

<xsl:template match="pubdate">
<mods:originInfo>
<mods:dateCreated point="start">
<xsl:value-of select="." />
</mods:dateCreated>
</mods:originInfo>
</xsl:template>

<xsl:template match="abstract">
<mods:abstract><xsl:value-of select="." /></mods:abstract>
</xsl:template>

<xsl:template match="accconst">
<mods:accessCondition type="restrictionOnAccess">
<xsl:value-of
select="concat(
translate(normalize-space(.), '.', ''), '. ',
normalize-space(//distinfo/distliab))" />
</mods:accessCondition>
</xsl:template>

<xsl:template match="bounding">
<mods:subject>
<mods:cartographic>
<mods:coordinates>
<xsl:value-of select="concat(
eastbc, ',', southbc, ' ',
eastbc, ',', northbc, ' ',
westbc, ',', northbc, ' ',
westbc, ',', southbc
)" />
</mods:coordinates>
</mods:cartographic>
</mods:subject>
</xsl:template>

<xsl:template match="direct">
<xsl:if test="translate(., $uppercase, $lowercase) = 'raster'">
<mods:typeOfResource>Image</mods:typeOfResource>
</xsl:if>
</xsl:template>

<xsl:template match="text()"></xsl:template>

</xsl:stylesheet>
Expand Up @@ -5,8 +5,26 @@
<citeinfo>
<origin>Ginnungagap, the Yawning Emptiness of Abyssal Chaos</origin>
<title>Some land</title>
<pubdate>20031001</pubdate>
</citeinfo>
</citation>
<accconst>Unrestricted Access Online</accconst>
<descript>
<abstract>This is a picture of some land. It has some stuff on it.</abstract>
</descript>
<accconst>Unrestricted Access Online.</accconst>
<spdom>
<bounding>
<westbc>10</westbc>
<eastbc>30</eastbc>
<northbc>71</northbc>
<southbc>70</southbc>
</bounding>
</spdom>
</idinfo>
<spdoinfo>
<direct>Raster</direct>
</spdoinfo>
<distinfo>
<distliab>Use at your own risk.</distliab>
</distinfo>
</metadata>

0 comments on commit 22525a0

Please sign in to comment.