Skip to content

Commit

Permalink
Add mapping of locality, coords, altitude, areas.
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Jul 18, 2024
1 parent e78754d commit 4f6bf23
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions transformations/abcd2bioschemas/abcd2bioschemas-xml.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,53 @@ exclude-result-prefixes="xsl md panxslt set">
</usageInfo>
</xsl:for-each>

<xsl:for-each select="$country[not(.=preceding::*)]">
<spatialCoverage type="Country">
<name><xsl:value-of select="."/></name>
<identifier><xsl:value-of select="../abcd:ISO3166Code"/></identifier>
</spatialCoverage>
<xsl:for-each select="/abcd:DataSets/abcd:DataSet/abcd:Units/abcd:Unit">
<xsl:variable name="unit_locality" select="./abcd:Gathering/abcd:LocalityText"></xsl:variable>
<xsl:variable name="unit_coordinates" select="./abcd:Gathering/abcd:SiteCoordinateSets/abcd:SiteCoordinates/abcd:CoordinatesLatLong"></xsl:variable>
<xsl:variable name="unit_latitude" select="./abcd:Gathering/abcd:SiteCoordinateSets/abcd:SiteCoordinates/abcd:CoordinatesLatLong/abcd:LatitudeDecimal"></xsl:variable>
<xsl:variable name="unit_longitude" select="./abcd:Gathering/abcd:SiteCoordinateSets/abcd:SiteCoordinates/abcd:CoordinatesLatLong/abcd:LongitudeDecimal"></xsl:variable>
<xsl:variable name="unit_altitude" select="./abcd:Gathering/abcd:Altitude"></xsl:variable>
<xsl:variable name="unit_country" select="./abcd:Gathering/abcd:Country/abcd:Name"></xsl:variable>
<xsl:variable name="unit_named_areas" select="./abcd:Gathering/abcd:NamedAreas/abcd:NamedArea"></xsl:variable>

<xsl:for-each select="$unit_country[not(.=preceding::*)]">
<spatialCoverage type="Country">
<name><xsl:value-of select="."/></name>
<identifier><xsl:value-of select="../abcd:ISO3166Code"/></identifier>
</spatialCoverage>
</xsl:for-each>

<xsl:for-each select="$unit_locality[not(.=preceding::*)]">
<spatialCoverage type="Place">
<name><xsl:value-of select="."/></name>
<description><xsl:value-of select="."/></description>
<xsl:if test="$unit_coordinates">
<geo type="GeoCoordinates">
<xsl:if test="$unit_latitude">
<latitude xsi:type="xs:double"><xsl:value-of select="$unit_latitude"/></latitude>
</xsl:if>
<xsl:if test="$unit_longitude">
<longitude xsi:type="xs:double"><xsl:value-of select="$unit_longitude"/></longitude>
</xsl:if>
<xsl:if test="$unit_altitude">
<elevation xsi:type="xs:double"><xsl:value-of select="$unit_altitude"/></elevation>
</xsl:if>
</geo>
</xsl:if>
<xsl:if test="$unit_named_areas">
<xsl:for-each select="$unit_named_areas">
<containedInPlace type="Place">
<name><xsl:value-of select="."/></name>
<xsl:if test="./abcd:AreaClass">
<additionalType><xsl:value-of select="./abcd:AreaClass"/></additionalType>
</xsl:if>
</containedInPlace>
</xsl:for-each>
</xsl:if>
</spatialCoverage>
</xsl:for-each>
</xsl:for-each>

<!-- get bounding box coordinates or coordinate pair, if there is only one -->
<xsl:if test="$coordinates/abcd:LatitudeDecimal and $coordinates/abcd:LongitudeDecimal">
<spatialCoverage type="Place">
Expand Down

1 comment on commit 4f6bf23

@airnst
Copy link
Collaborator

@airnst airnst commented on 4f6bf23 Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[#12]

Please sign in to comment.