Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
4452 lines (4443 sloc) 236 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
======================================================================
FGDC RSE to ISO 19115-2 Transform using XPath 2.0 June 2011
This is the XML Style sheet that transforms metadata conforming to the Content Standards
for Digital Geospatial Metadata: Extensions for Remote Sensing Metadata of the Federal
Geographic Data Committee FGDC-STD-012-2002 version to the ISO 19115-2:2009(E).
This stylesheet can be applied to FGDC RSE XML to generate ISO 19115-2 XML.
This file was generated by Altova MapForce 2009sp1
Authors:
This is the result of a collaboration of the Metadata Transform Working Group.
For further information, please contact NOAA's National Coastal Data
Development Center (NCDDC).
National Coastal Data Development Center
Toll Free: 866.732.2382
E-mail: ncddcmetadata@noaa.gov
Editors:
Anna.Milan@noaa.gov,
Ted.Habermann@noaa.gov
Distribution Liability:
NOAA makes no warranty regarding these data, expressed or implied,
nor does the fact of distribution constitute such a warranty. NOAA, NESDIS,
NODC and NCDDC cannot assume liability for any damages caused by any
errors or omissions in these data, nor as a result of the failure of these data
to function on a particular system. These files were developed for opensource uses.
Use Constraints:
The user is responsible for the results of any application of these transforms for other than its
intended purpose. These transforms cannot guarantee valid output. Additional editing
may need to be done in order to have valid records. The intent of these transforms is
to get as much of the FGDC valid content mapped to ISO content as possible but cannot
guarantee against loss of information. Please feel free to edit transforms as needed for
your organizations needs.
See fgdcrse2iso19115-2-revisionHistory.txt for listing of all changes to this document.
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vmf="http://www.altova.com/MapForce/UDF/vmf" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:grp="http://www.altova.com/Mapforce/grouping" exclude-result-prefixes="fn grp vmf xs xsi xsl">
<xsl:variable name="thisXSLT">FGDC RSE to ISO 19115-2 transform</xsl:variable>
<xsl:variable name="LastUpdateXSLT">2012-06-20T17:21:00</xsl:variable>
<!-- MD_CellGeometryCode -->
<xsl:template name="vmf:vmf1_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='POINT'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='PIXEL'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='GRID CELL'">
<xsl:value-of select="'area'"/>
</xsl:when>
<xsl:when test="$input='VOXEL'">
<xsl:value-of select="'area'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- MD_GeometricObjectTypeCode -->
<xsl:template name="vmf:vmf3_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='POINT'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='ENTITY POINT'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='LABEL POINT'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='AREA POINT'">
<xsl:value-of select="'point'"/>
</xsl:when>
<xsl:when test="$input='NODE, PLANAR GRAPH'">
<xsl:value-of select="'surface'"/>
</xsl:when>
<xsl:when test="$input='NODE, NETWORK'">
<xsl:value-of select="'surface'"/>
</xsl:when>
<xsl:when test="$input='STRING'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='LINK'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='COMPLETE CHAIN'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='AREA CHAIN'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='NETWORK CHAIN, PLANAR GRAPH'">
<xsl:value-of select="'surface'"/>
</xsl:when>
<xsl:when test="$input='NETWORK CHAIN, NONPLANAR GRAPH'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='CIRCULAR ARC, THREE POINT CENTER'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='ELLIPTICAL ARC'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='UNIFORM B-SPLINE'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='PIECEWISE BEZIER'">
<xsl:value-of select="'curve'"/>
</xsl:when>
<xsl:when test="$input='RING WITH MIXED COMPOSITION'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='RING COMPOSED OF STRINGS'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='RING COMPOSED OF CHAINS'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='RING COMPOSED OF ARCS'">
<xsl:value-of select="'composite'"/>
</xsl:when>
<xsl:when test="$input='G-POLYGON'">
<xsl:value-of select="'complex'"/>
</xsl:when>
<xsl:when test="$input='GT-POLYGON COMPOSED OF RINGS'">
<xsl:value-of select="'complex'"/>
</xsl:when>
<xsl:when test="$input='GT-POLYGON COMPOSED OF CHAINS'">
<xsl:value-of select="'complex'"/>
</xsl:when>
<xsl:when test="$input='UNIVERSE POLYGON COMPOSED OF RINGS'">
<xsl:value-of select="'complex'"/>
</xsl:when>
<xsl:when test="$input='UNIVERSE POLYGON COMPOSED OF CHAINS'">
<xsl:value-of select="'complex'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- uom units -->
<xsl:template name="vmf:vmf5_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='DECIMAL DEGREES'">
<xsl:value-of select="'decimalDegrees'"/>
</xsl:when>
<xsl:when test="$input='DECIMAL MINUTES'">
<xsl:value-of select="'decimalMinutes'"/>
</xsl:when>
<xsl:when test="$input='DECIMAL SECONDS'">
<xsl:value-of select="'decimalSeconds'"/>
</xsl:when>
<xsl:when test="$input='DEGREES and DECIMAL MINUTES'">
<xsl:value-of select="'degreesAndDecimalMinutes'"/>
</xsl:when>
<xsl:when test="$input='DEGREES, MINUTES, and DECIMAL SECONDS'">
<xsl:value-of select="'degreesMinutesAndDecimalSeconds'"/>
</xsl:when>
<xsl:when test="$input='RADIANS'">
<xsl:value-of select="'radians'"/>
</xsl:when>
<xsl:when test="$input='GRADS'">
<xsl:value-of select="'grads'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- geoform -->
<xsl:template name="vmf:vmf7_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='ATLAS'">
<xsl:value-of select="'mapHardcopy'"/>
</xsl:when>
<xsl:when test="$input='AUDIO'">
<xsl:value-of select="'documentDigital'"/>
</xsl:when>
<xsl:when test="$input='DIAGRAM'">
<xsl:value-of select="'documentDigital'"/>
</xsl:when>
<xsl:when test="$input='DOCUMENT'">
<xsl:value-of select="'documentDigital'"/>
</xsl:when>
<xsl:when test="$input='GLOBE'">
<xsl:value-of select="'documentHardcopy'"/>
</xsl:when>
<xsl:when test="$input='MAP'">
<xsl:value-of select="'mapDigital'"/>
</xsl:when>
<xsl:when test="$input='PRINTED MAP'">
<xsl:value-of select="'mapHardcopy'"/>
</xsl:when>
<xsl:when test="$input='MODEL'">
<xsl:value-of select="'modelDigital'"/>
</xsl:when>
<xsl:when test="$input='PHYSICAL MODEL'">
<xsl:value-of select="'modelHardcopy'"/>
</xsl:when>
<xsl:when test="$input='MULTIMEDIA PRESENTATION'">
<xsl:value-of select="'imageDigital'"/>
</xsl:when>
<xsl:when test="$input='PROFILE'">
<xsl:value-of select="'profileDigital'"/>
</xsl:when>
<xsl:when test="$input='CROSS-SECTION'">
<xsl:value-of select="'profileHardcopy'"/>
</xsl:when>
<xsl:when test="$input='RASTER DIGITAL DATA'">
<xsl:value-of select="'mapDigital'"/>
</xsl:when>
<xsl:when test="$input='REMOTE-SENSING IMAGE'">
<xsl:value-of select="'imageDigital'"/>
</xsl:when>
<xsl:when test="$input='SECTION'">
<xsl:value-of select="'profileHardcopy'"/>
</xsl:when>
<xsl:when test="$input='SPREADSHEET'">
<xsl:value-of select="'tableDigital'"/>
</xsl:when>
<xsl:when test="$input='TABULAR DIGITAL DATA'">
<xsl:value-of select="'tableDigital'"/>
</xsl:when>
<xsl:when test="$input='VECTOR DIGITAL DATA'">
<xsl:value-of select="'mapDigital'"/>
</xsl:when>
<xsl:when test="$input='VIDEO'">
<xsl:value-of select="'videoDigital'"/>
</xsl:when>
<xsl:when test="$input='VIEW'">
<xsl:value-of select="'imageDigital'"/>
</xsl:when>
<xsl:when test="$input='DATABASE'">
<xsl:value-of select="'documentDigital'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf9_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='COMPLETED'">
<xsl:value-of select="'completed'"/>
</xsl:when>
<xsl:when test="$input='COMPLETE'">
<xsl:value-of select="'completed'"/>
</xsl:when>
<xsl:when test="$input='ARCHIVED'">
<xsl:value-of select="'historicalArchive'"/>
</xsl:when>
<xsl:when test="$input='OBSOLETE'">
<xsl:value-of select="'obsolete'"/>
</xsl:when>
<xsl:when test="$input='ON GOING'">
<xsl:value-of select="'onGoing'"/>
</xsl:when>
<xsl:when test="$input='CONTINUALLY'">
<xsl:value-of select="'onGoing'"/>
</xsl:when>
<xsl:when test="$input='PLANNED'">
<xsl:value-of select="'planned'"/>
</xsl:when>
<xsl:when test="$input='REQUIRED'">
<xsl:value-of select="'required'"/>
</xsl:when>
<xsl:when test="$input='IN PROGRESS'">
<xsl:value-of select="'underDevelopment'"/>
</xsl:when>
<xsl:when test="$input='IN WORK'">
<xsl:value-of select="'underDevelopment'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf11_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='CONTINUALLY'">
<xsl:value-of select="'continual'"/>
</xsl:when>
<xsl:when test="$input='DAILY'">
<xsl:value-of select="'daily'"/>
</xsl:when>
<xsl:when test="$input='WEEKLY'">
<xsl:value-of select="'weekly'"/>
</xsl:when>
<xsl:when test="$input='TWO WEEKS'">
<xsl:value-of select="'fortnightly'"/>
</xsl:when>
<xsl:when test="$input='MONTHLY'">
<xsl:value-of select="'monthly'"/>
</xsl:when>
<xsl:when test="$input='QUARTERLY'">
<xsl:value-of select="'quarterly'"/>
</xsl:when>
<xsl:when test="$input='BIANNUALLY'">
<xsl:value-of select="'biannually'"/>
</xsl:when>
<xsl:when test="$input='ANNUALLY'">
<xsl:value-of select="'annually'"/>
</xsl:when>
<xsl:when test="$input='YEARLY'">
<xsl:value-of select="'annually'"/>
</xsl:when>
<xsl:when test="$input='AS NEEDED'">
<xsl:value-of select="'asNeeded'"/>
</xsl:when>
<xsl:when test="$input='IRREGULAR'">
<xsl:value-of select="'irregular'"/>
</xsl:when>
<xsl:when test="$input='NOT PLANNED'">
<xsl:value-of select="'notPlanned'"/>
</xsl:when>
<xsl:when test="$input='NONE PLANNED'">
<xsl:value-of select="'notPlanned'"/>
</xsl:when>
<xsl:when test="$input='UNKNOWN'">
<xsl:value-of select="'unknown'"/>
</xsl:when>
<xsl:when test="$input='NONE'">
<xsl:value-of select="'notPlanned'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf13_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='CONFIDENTIAL'">
<xsl:value-of select="'confidential'"/>
</xsl:when>
<xsl:when test="$input='SECRET'">
<xsl:value-of select="'secret'"/>
</xsl:when>
<xsl:when test="$input='TOP SECRET'">
<xsl:value-of select="'topSecret'"/>
</xsl:when>
<xsl:when test="$input='UNCLASSIFIED'">
<xsl:value-of select="'unclassified'"/>
</xsl:when>
<xsl:when test="$input='RESTRICTED'">
<xsl:value-of select="'restricted'"/>
</xsl:when>
<xsl:when test="$input='SENSITIVE'">
<xsl:value-of select="'restricted'"/>
</xsl:when>
<xsl:when test="$input='SECERT'">
<xsl:value-of select="'secret'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf15_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='POINT'">
<xsl:value-of select="'vector'"/>
</xsl:when>
<xsl:when test="$input='VECTOR'">
<xsl:value-of select="'vector'"/>
</xsl:when>
<xsl:when test="$input='RASTER'">
<xsl:value-of select="'grid'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf17_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='CD-ROM'">
<xsl:value-of select="'cdRom'"/>
</xsl:when>
<xsl:when test="$input='DVD'">
<xsl:value-of select="'dvd'"/>
</xsl:when>
<xsl:when test="$input='DVD-ROM'">
<xsl:value-of select="'dvdRom'"/>
</xsl:when>
<xsl:when test="$input='3-1/2 INCH FLOPPY DISK'">
<xsl:value-of select="'3halfInchFloppy'"/>
</xsl:when>
<xsl:when test="$input='5-1/4 INCH FLOPPY'">
<xsl:value-of select="'5quarterInchFloppy'"/>
</xsl:when>
<xsl:when test="$input='7-TRACK TAPE'">
<xsl:value-of select="'7trackTape'"/>
</xsl:when>
<xsl:when test="$input='9-TRACK TAPE'">
<xsl:value-of select="'9trackType'"/>
</xsl:when>
<xsl:when test="$input='9-TRACK'">
<xsl:value-of select="'9trackTape'"/>
</xsl:when>
<xsl:when test="$input='3480 CARTRIDGE'">
<xsl:value-of select="'3480Cartridge'"/>
</xsl:when>
<xsl:when test="$input='3490 CARTRIDGE'">
<xsl:value-of select="'3490Cartridge'"/>
</xsl:when>
<xsl:when test="$input='3580 CARTRIDGE'">
<xsl:value-of select="'3580Cartridge'"/>
</xsl:when>
<xsl:when test="$input='4 MM CARTRIDGE'">
<xsl:value-of select="'4mmCartridgeTape'"/>
</xsl:when>
<xsl:when test="$input='8 MM CARTRIDGE'">
<xsl:value-of select="'8mmCartridgeTape'"/>
</xsl:when>
<xsl:when test="$input='1/4 INCH CARTRIDGE'">
<xsl:value-of select="'1quarterInchCartridgeTape'"/>
</xsl:when>
<xsl:when test="$input='DIGITAL LINEAR TAPE'">
<xsl:value-of select="'digitalLinearTape'"/>
</xsl:when>
<xsl:when test="$input='ONLINE'">
<xsl:value-of select="'onLine'"/>
</xsl:when>
<xsl:when test="$input='SATELLITE'">
<xsl:value-of select="'satellite'"/>
</xsl:when>
<xsl:when test="$input='TELEPHONE LINK'">
<xsl:value-of select="'telephoneLink'"/>
</xsl:when>
<xsl:when test="$input='HARDCOPY'">
<xsl:value-of select="'hardcopy'"/>
</xsl:when>
<xsl:when test="$input='CD ROM'">
<xsl:value-of select="'cdRom'"/>
</xsl:when>
<xsl:when test="$input='CDROM'">
<xsl:value-of select="'cdRom'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="vmf:vmf19_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='CPIO'">
<xsl:value-of select="'cpio'"/>
</xsl:when>
<xsl:when test="$input='TAR'">
<xsl:value-of select="'tar'"/>
</xsl:when>
<xsl:when test="$input='HIGH SEIRRA'">
<xsl:value-of select="'highSierra'"/>
</xsl:when>
<xsl:when test="$input='ISO 9660'">
<xsl:value-of select="'iso9660'"/>
</xsl:when>
<xsl:when test="$input='ISO 9660 WITH ROCK RIDGE'">
<xsl:value-of select="'iso9660RockRidge'"/>
</xsl:when>
<xsl:when test="$input='ISO 9660 UNIX'">
<xsl:value-of select="'iso9660RockRidge'"/>
</xsl:when>
<xsl:when test="$input='ISO 9660 WITH APPLE HFS'">
<xsl:value-of select="'iso9660AppleHFS'"/>
</xsl:when>
<xsl:when test="$input='ISO 9660 MAC'">
<xsl:value-of select="'iso9660AppleHFS'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="functionCode">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='DOWNLOAD'">
<xsl:value-of select="'download'"/>
</xsl:when>
<xsl:when test="$input='INFORMATION'">
<xsl:value-of select="'information'"/>
</xsl:when>
<xsl:when test="$input='ORDER'">
<xsl:value-of select="'order'"/>
</xsl:when>
<xsl:when test="$input='SEARCH'">
<xsl:value-of select="'search'"/>
</xsl:when>
<xsl:when test="$input='OFFLINEACCESS'">
<xsl:value-of select="'offlineAccess'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$input"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:function name="grp:key1b9404f8">
<xsl:param name="cur"/>
<xsl:for-each select="$cur/origin">
<xsl:sequence select="xs:string(xs:string(.))"/>
</xsl:for-each>
</xsl:function>
<xsl:template match="/">
<gmi:MI_Metadata>
<xsl:attribute name="xsi:schemaLocation" separator=" ">
<xsl:sequence select="'http://www.isotc211.org/2005/gmi http://www.ngdc.noaa.gov/metadata/published/xsd/schema.xsd'"/>
</xsl:attribute>
<xsl:variable name="var1_instance" as="node()" select="."/>
<gmd:fileIdentifier>
<xsl:for-each select="$var1_instance/metadata">
<gco:CharacterString>
<xsl:choose>
<xsl:when test="idinfo/datsetid">
<xsl:sequence select="fn:normalize-space(fn:concat(' ', xs:string(idinfo/datsetid)))"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="replace(replace(tokenize(fn:base-uri(.),'/')[last()],'%20',' '),'.xml','')"/>
</xsl:otherwise>
</xsl:choose>
</gco:CharacterString>
</xsl:for-each>
</gmd:fileIdentifier>
<gmd:language>
<gco:CharacterString>
<xsl:sequence select="'eng; USA'"/>
</gco:CharacterString>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('utf8'))"/>
</xsl:attribute>
<xsl:sequence select="'utf8'"/>
</gmd:MD_CharacterSetCode>
</gmd:characterSet>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('dataset'))"/>
</xsl:attribute>
<xsl:sequence select="'dataset'"/>
</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<xsl:for-each select="//metainfo/metc/cntinfo">
<gmd:contact>
<xsl:call-template name="CI_ResponsibleParty">
<xsl:with-param name="role">pointOfContact</xsl:with-param>
</xsl:call-template>
</gmd:contact>
</xsl:for-each>
<gmd:dateStamp>
<xsl:choose>
<xsl:when test="(fn:contains(fn:lower-case(fn:normalize-space(fn:string(//metd))), 'unknown'))">
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string('unknown')"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<gco:Date>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(//metd)"/>
</xsl:call-template>
</gco:Date>
</xsl:otherwise>
</xsl:choose>
</gmd:dateStamp>
<gmd:metadataStandardName>
<gco:CharacterString>
<xsl:sequence select="'ISO 19115-2 Geographic Information - Metadata - Part 2: Extensions for Imagery and Gridded Data'"/>
</gco:CharacterString>
</gmd:metadataStandardName>
<gmd:metadataStandardVersion>
<gco:CharacterString>
<xsl:sequence select="'ISO 19115-2:2009(E)'"/>
</gco:CharacterString>
</gmd:metadataStandardVersion>
<xsl:for-each select="$var1_instance/metadata">
<xsl:variable name="var76_metadata" as="node()" select="."/>
<xsl:for-each select="spdoinfo/rastinfo">
<gmd:spatialRepresentationInfo>
<xsl:variable name="var80_rastinfo" as="node()" select="."/>
<gmd:MD_GridSpatialRepresentation>
<gmd:numberOfDimensions>
<xsl:variable name="row" as="xs:integer?" select="(if (fn:exists(rowcount)) then xs:integer(1) else xs:integer(0))"/>
<xsl:variable name="col" as="xs:integer?" select="(if (fn:exists(colcount)) then xs:integer(1) else xs:integer(0))"/>
<xsl:variable name="vert" as="xs:integer?" select="(if (fn:exists(vrtcount)) then xs:integer(1) else xs:integer(0))"/>
<gco:Integer>
<xsl:value-of select="xs:string(xs:integer($row + $col + $vert))"/>
</gco:Integer>
</gmd:numberOfDimensions>
<xsl:if test="./rowcount">
<gmd:axisDimensionProperties>
<gmd:MD_Dimension>
<gmd:dimensionName>
<xsl:variable name="var87_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/rowcount)) then 'row' else ())"/>
<xsl:if test="fn:exists($var87_cond_result_exists)">
<gmd:MD_DimensionNameTypeCode>
<xsl:variable name="var88_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/rowcount)) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode' else ())"/>
<xsl:if test="fn:exists($var88_cond_result_exists)">
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(($var88_cond_result_exists))"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var87_cond_result_exists))"/>
</xsl:attribute>
<xsl:sequence select="$var87_cond_result_exists"/>
</gmd:MD_DimensionNameTypeCode>
</xsl:if>
</gmd:dimensionName>
<gmd:dimensionSize>
<xsl:for-each select="$var80_rastinfo/rowcount">
<gco:Integer>
<xsl:sequence select="xs:string((.))"/>
</gco:Integer>
</xsl:for-each>
</gmd:dimensionSize>
</gmd:MD_Dimension>
</gmd:axisDimensionProperties>
</xsl:if>
<xsl:if test="./colcount">
<gmd:axisDimensionProperties>
<gmd:MD_Dimension>
<gmd:dimensionName>
<xsl:variable name="var94_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/colcount)) then 'column' else ())"/>
<xsl:if test="fn:exists($var94_cond_result_exists)">
<gmd:MD_DimensionNameTypeCode>
<xsl:variable name="var95_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/colcount)) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode' else ())"/>
<xsl:if test="fn:exists($var95_cond_result_exists)">
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(($var95_cond_result_exists))"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var94_cond_result_exists))"/>
</xsl:attribute>
<xsl:sequence select="$var94_cond_result_exists"/>
</gmd:MD_DimensionNameTypeCode>
</xsl:if>
</gmd:dimensionName>
<gmd:dimensionSize>
<xsl:for-each select="$var80_rastinfo/colcount">
<gco:Integer>
<xsl:sequence select="xs:string(.)"/>
</gco:Integer>
</xsl:for-each>
</gmd:dimensionSize>
</gmd:MD_Dimension>
</gmd:axisDimensionProperties>
</xsl:if>
<xsl:if test="./vrtcount">
<gmd:axisDimensionProperties>
<gmd:MD_Dimension>
<gmd:dimensionName>
<xsl:variable name="var101_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/vrtcount)) then 'vertical' else ())"/>
<xsl:if test="fn:exists($var101_cond_result_exists)">
<gmd:MD_DimensionNameTypeCode>
<xsl:variable name="var102_cond_result_exists" as="xs:string?" select="(if (fn:exists($var80_rastinfo/vrtcount)) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode' else ())"/>
<xsl:if test="fn:exists($var102_cond_result_exists)">
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(($var102_cond_result_exists))"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var101_cond_result_exists))"/>
</xsl:attribute>
<xsl:sequence select="$var101_cond_result_exists"/>
</gmd:MD_DimensionNameTypeCode>
</xsl:if>
</gmd:dimensionName>
<gmd:dimensionSize>
<xsl:for-each select="$var80_rastinfo/vrtcount">
<gco:Integer>
<xsl:sequence select="xs:string(xs:integer(xs:positiveInteger(.)))"/>
</gco:Integer>
</xsl:for-each>
</gmd:dimensionSize>
</gmd:MD_Dimension>
</gmd:axisDimensionProperties>
</xsl:if>
<gmd:cellGeometry>
<xsl:variable name="var119_map_select_rasttype" as="xs:string?">
<xsl:for-each select="rasttype">
<xsl:sequence select="fn:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var106_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists($var119_map_select_rasttype)">
<xsl:for-each select="rasttype">
<xsl:variable name="var123_result_vmf1_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf1_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(fn:string(.)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var123_result_vmf1_inputtoresult)">
<xsl:sequence select="$var123_result_vmf1_inputtoresult"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="fn:exists($var106_cond_result_exists)">
<gmd:MD_CellGeometryCode>
<xsl:attribute name="codeList">
<xsl:variable name="var108_map_select_rasttype" as="xs:string?">
<xsl:for-each select="rasttype">
<xsl:sequence select="fn:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var107_cond_result_exists" as="xs:string" select="(if (fn:exists($var108_map_select_rasttype)) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_CellGeometryCode' else '')"/>
<xsl:sequence select="xs:string(($var107_cond_result_exists))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var106_cond_result_exists))"/>
</xsl:attribute>
<xsl:variable name="var112_map_select_rasttype" as="xs:string?">
<xsl:for-each select="rasttype">
<xsl:sequence select="fn:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="$var106_cond_result_exists"/>
</gmd:MD_CellGeometryCode>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="'template'"/>
</xsl:attribute>
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //spdoinfo/rastinfo/rasttype</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</gmd:cellGeometry>
<gmd:transformationParameterAvailability>
<xsl:variable name="var126_cond_result_exists" as="xs:string?" select="(if (fn:exists(rowcount)) then 'unknown' else ())"/>
<xsl:if test="fn:exists($var126_cond_result_exists)">
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string($var126_cond_result_exists))"/>
</xsl:attribute>
</xsl:if>
</gmd:transformationParameterAvailability>
</gmd:MD_GridSpatialRepresentation>
</gmd:spatialRepresentationInfo>
</xsl:for-each>
<xsl:for-each select="spdoinfo/ptvctinf">
<gmd:spatialRepresentationInfo>
<xsl:variable name="var127_ptvctinf" as="node()" select="."/>
<gmd:MD_VectorSpatialRepresentation>
<xsl:for-each select="vpfterm">
<gmd:topologyLevel>
<gmd:MD_TopologyLevelCode>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="'template'"/>
</xsl:attribute>
</gmd:MD_TopologyLevelCode>
<xsl:comment>
<xsl:text>FGDC content did not map to ISO. Hand edit MD_TopologyLevelCode. </xsl:text>
</xsl:comment>
<xsl:comment>
<xsl:text>vpflevel: </xsl:text>
<xsl:sequence select="xs:string((fn:normalize-space(fn:string(vpflevel))))"/>
</xsl:comment>
</gmd:topologyLevel>
</xsl:for-each>
<gmd:geometricObjects>
<gmd:MD_GeometricObjects>
<gmd:geometricObjectType>
<xsl:variable name="var154_map_select_sdtsterm" as="xs:string*">
<xsl:for-each select="sdtsterm">
<xsl:sequence select="fn:string(sdtstype)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var131_cond_result_exists" as="xs:string?">
<xsl:if test="fn:exists($var154_map_select_sdtsterm)">
<xsl:variable name="var156_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists($var154_map_select_sdtsterm)">
<xsl:variable name="var162_map_select_sdtsterm" as="xs:string*">
<xsl:for-each select="sdtsterm">
<xsl:if test="fn:exists($var154_map_select_sdtsterm)">
<xsl:sequence select="fn:string(sdtstype)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var162_map_select_sdtsterm)">
<xsl:sequence select="fn:string-join($var162_map_select_sdtsterm, ' ')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="vpfterm">
<xsl:sequence select="fn:string(vpflevel)"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var156_cond_result_exists">
<xsl:variable name="var159_result_vmf3_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf3_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(fn:string(.)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var159_result_vmf3_inputtoresult)">
<xsl:sequence select="$var159_result_vmf3_inputtoresult"/>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="fn:exists($var131_cond_result_exists)">
<gmd:MD_GeometricObjectTypeCode>
<xsl:variable name="var132_map_select_vpfterm" as="xs:string?">
<xsl:for-each select="vpfterm">
<xsl:sequence select="fn:string(vpflevel)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var133_map_select_sdtsterm" as="xs:string*">
<xsl:for-each select="sdtsterm">
<xsl:sequence select="fn:string(sdtstype)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists((if ((fn:exists($var133_map_select_sdtsterm) or fn:exists($var132_map_select_vpfterm))) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_GeometricObjectTypeCode' else ()))">
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string((fn:string((if ((fn:exists($var133_map_select_sdtsterm) or fn:exists($var132_map_select_vpfterm))) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_GeometricObjectTypeCode' else ()))))"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string((fn:string($var131_cond_result_exists)))"/>
</xsl:attribute>
<xsl:variable name="var139_map_select_sdtsterm" as="xs:string*">
<xsl:for-each select="sdtsterm">
<xsl:sequence select="fn:string(sdtstype)"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="fn:string($var131_cond_result_exists)"/>
</gmd:MD_GeometricObjectTypeCode>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="'template'"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:geometricObjectType>
<xsl:if test=".//ptvctcnt">
<gmd:geometricObjectCount>
<xsl:variable name="var172_map_select_sdtsterm" as="xs:string*">
<xsl:for-each select="sdtsterm/ptvctcnt">
<xsl:sequence select="xs:string(xs:integer(.))"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var169_cond_result_exists" as="xs:string*">
<xsl:choose>
<xsl:when test="fn:exists($var172_map_select_sdtsterm)">
<xsl:for-each select="sdtsterm/ptvctcnt">
<xsl:sequence select="xs:string(xs:integer(.))"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="vpfterm/vpfinfo/ptvctcnt">
<xsl:sequence select="xs:string(xs:integer(.))"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var169_cond_result_exists">
<gco:Integer>
<xsl:sequence select="xs:string(xs:integer(.))"/>
</gco:Integer>
</xsl:for-each>
</gmd:geometricObjectCount>
</xsl:if>
</gmd:MD_GeometricObjects>
</gmd:geometricObjects>
</gmd:MD_VectorSpatialRepresentation>
</gmd:spatialRepresentationInfo>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata">
<xsl:variable name="var180_metadata" as="node()" select="."/>
<xsl:for-each select="spref/horizsys/geograph">
<gmd:spatialRepresentationInfo>
<gmd:MD_GridSpatialRepresentation>
<gmd:numberOfDimensions>
<gco:Integer>
<xsl:sequence select="xs:string(xs:integer(xs:decimal(2)))"/>
</gco:Integer>
</gmd:numberOfDimensions>
<gmd:axisDimensionProperties>
<gmd:MD_Dimension>
<gmd:dimensionName>
<gmd:MD_DimensionNameTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('column'))"/>
</xsl:attribute>
<xsl:sequence select="'column'"/>
</gmd:MD_DimensionNameTypeCode>
</gmd:dimensionName>
<gmd:dimensionSize>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:dimensionSize>
<gmd:resolution>
<gco:Scale>
<xsl:variable name="var184_result_vmf5_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf5_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(xs:string(xs:token(geogunit)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var184_result_vmf5_inputtoresult)">
<xsl:attribute name="uom">
<xsl:sequence select="xs:string(xs:string($var184_result_vmf5_inputtoresult))"/>
</xsl:attribute>
</xsl:if>
<xsl:sequence select="normalize-space(latres)"/>
<!--<xsl:sequence select="xs:string(xs:double(latres))"/>-->
</gco:Scale>
</gmd:resolution>
</gmd:MD_Dimension>
</gmd:axisDimensionProperties>
<gmd:axisDimensionProperties>
<gmd:MD_Dimension>
<gmd:dimensionName>
<gmd:MD_DimensionNameTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('row'))"/>
</xsl:attribute>
<xsl:sequence select="'row'"/>
</gmd:MD_DimensionNameTypeCode>
</gmd:dimensionName>
<gmd:dimensionSize>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:dimensionSize>
<gmd:resolution>
<gco:Scale>
<xsl:variable name="var185_result_vmf5_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf5_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(xs:string(xs:token(geogunit)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var185_result_vmf5_inputtoresult)">
<xsl:attribute name="uom">
<xsl:sequence select="xs:string(xs:string($var185_result_vmf5_inputtoresult))"/>
</xsl:attribute>
</xsl:if>
<xsl:sequence select="xs:string((longres))"/>
</gco:Scale>
</gmd:resolution>
</gmd:MD_Dimension>
</gmd:axisDimensionProperties>
<gmd:cellGeometry>
<xsl:variable name="var186_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists($var180_metadata/spdoinfo/rastinfo/rasttype)">
<xsl:for-each select="$var180_metadata/spdoinfo/rastinfo/rasttype">
<xsl:variable name="var196_result_vmf1_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf1_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:token(.))))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var196_result_vmf1_inputtoresult)">
<xsl:sequence select="$var196_result_vmf1_inputtoresult"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="fn:exists($var186_cond_result_exists)">
<gmd:MD_CellGeometryCode>
<xsl:attribute name="codeList">
<xsl:variable name="var187_cond_result_exists" as="xs:string" select="(if (fn:exists($var180_metadata/spdoinfo/rastinfo/rasttype)) then 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_CellGeometryCode' else '')"/>
<xsl:sequence select="xs:string(($var187_cond_result_exists))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var186_cond_result_exists))"/>
</xsl:attribute>
<xsl:sequence select="$var186_cond_result_exists"/>
</gmd:MD_CellGeometryCode>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="'template'"/>
</xsl:attribute>
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //spdoinfo/rastinfo/rasttype</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</gmd:cellGeometry>
<gmd:transformationParameterAvailability>
<gco:Boolean>
<xsl:sequence select="xs:string(((('0' != 'false') and ('false' != 'false')) and fn:boolean('false')))"/>
</gco:Boolean>
</gmd:transformationParameterAvailability>
</gmd:MD_GridSpatialRepresentation>
</gmd:spatialRepresentationInfo>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata/spdoinfo/indspref">
<gmd:referenceSystemInfo gco:nilReason="template"/>
<xsl:comment>
<xsl:text>FGDC Content not mapped to ISO from Xpath: //spdoinfo/indspref</xsl:text>
</xsl:comment>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata/spref">
<gmd:referenceSystemInfo>
<xsl:attribute name="gco:nilReason" select="'template'"/>
</gmd:referenceSystemInfo>
<xsl:if test="//horizsys/geograph">
<xsl:comment>
<xsl:text>/horizsys/geograph mapped to MD_GridSpatialRepresentation</xsl:text>
</xsl:comment>
</xsl:if>
<xsl:if test="//spref">
<xsl:comment>Other FGDC spatial reference elements not mapped to ISO from Xpath: //spref</xsl:comment>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata">
<xsl:variable name="var201_metadata" as="node()" select="."/>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<xsl:for-each select="idinfo/citation/citeinfo">
<xsl:call-template name="CI_Citation"/>
</xsl:for-each>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(idinfo/descript/abstract))"/>
</gco:CharacterString>
</gmd:abstract>
<gmd:purpose>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(idinfo/descript/purpose))"/>
</gco:CharacterString>
</gmd:purpose>
<xsl:for-each-group select="idinfo/datacred" group-by="fn:normalize-space(xs:string(.))">
<xsl:variable name="var297_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gmd:credit>
<gco:CharacterString>
<xsl:sequence select="$var297_cur_result_groupby"/>
</gco:CharacterString>
</gmd:credit>
</xsl:for-each-group>
<xsl:if test="idinfo/status/progress">
<gmd:status>
<xsl:variable name="var302_result_vmf9_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf9_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(idinfo/status/progress)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="var299_cond_result_exists" as="xs:string?" select="(if (fn:exists($var302_result_vmf9_inputtoresult)) then $var302_result_vmf9_inputtoresult else ())"/>
<xsl:if test="fn:exists($var299_cond_result_exists)">
<gmd:MD_ProgressCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string($var299_cond_result_exists)"/>
</xsl:attribute>
<xsl:sequence select="$var299_cond_result_exists"/>
</gmd:MD_ProgressCode>
</xsl:if>
</gmd:status>
</xsl:if>
<xsl:for-each select="idinfo/ptcontac">
<!--<xsl:variable name="var303_ptcontac" as="node()" select="."/>-->
<gmd:pointOfContact>
<xsl:call-template name="CI_ResponsibleParty">
<xsl:with-param name="role">pointOfContact</xsl:with-param>
</xsl:call-template>
</gmd:pointOfContact>
</xsl:for-each>
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<xsl:variable name="var358_result_vmf11_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf11_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(idinfo/status/update))))"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="var355_cond_result_exists" as="xs:string?" select="(if (fn:exists($var358_result_vmf11_inputtoresult)) then $var358_result_vmf11_inputtoresult else ())"/>
<xsl:if test="fn:exists($var355_cond_result_exists)">
<gmd:MD_MaintenanceFrequencyCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string($var355_cond_result_exists)"/>
</xsl:attribute>
<!--<xsl:variable name="var357_result_vmf12_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf12_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(idinfo/status/update))))"/>
</xsl:call-template>
</xsl:variable>-->
<xsl:sequence select="$var355_cond_result_exists"/>
</gmd:MD_MaintenanceFrequencyCode>
</xsl:if>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<xsl:for-each select="eainfo/detailed/attr/attrmfrq">
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<xsl:variable name="var364_result_vmf11_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf11_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(.))))"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="var361_cond_result_exists" as="xs:string?" select="(if (fn:exists($var364_result_vmf11_inputtoresult)) then $var364_result_vmf11_inputtoresult else ())"/>
<xsl:if test="fn:exists($var361_cond_result_exists)">
<gmd:MD_MaintenanceFrequencyCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(($var361_cond_result_exists))"/>
</xsl:attribute>
<!--<xsl:variable name="var363_result_vmf12_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf12_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(.))))"/>
</xsl:call-template>
</xsl:variable>-->
<xsl:sequence select="$var361_cond_result_exists"/>
</gmd:MD_MaintenanceFrequencyCode>
</xsl:if>
</gmd:maintenanceAndUpdateFrequency>
<gmd:updateScope>
<gmd:MD_ScopeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('attribute'))"/>
</xsl:attribute>
</gmd:MD_ScopeCode>
</gmd:updateScope>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
</xsl:for-each>
<xsl:for-each select="idinfo/browse">
<gmd:graphicOverview>
<gmd:MD_BrowseGraphic>
<gmd:fileName>
<xsl:for-each-group select="." group-by="xs:string(browsen)">
<xsl:variable name="var369_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space($var369_cur_result_groupby)"/>
</gco:CharacterString>
</xsl:for-each-group>
</gmd:fileName>
<gmd:fileDescription>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(browsed))"/>
</gco:CharacterString>
</gmd:fileDescription>
<gmd:fileType>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(xs:string(browset)))"/>
</gco:CharacterString>
</gmd:fileType>
</gmd:MD_BrowseGraphic>
</gmd:graphicOverview>
</xsl:for-each>
<xsl:for-each-group select="idinfo/keywords/theme" group-by="(if (fn:contains(xs:string(xs:string(themekt)), 'ISO 19115')) then () else xs:string(xs:string(themekt)))">
<xsl:variable name="var372_cur_result_groupby" as="item()+" select="current-group()"/>
<xsl:variable name="var373_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="$var372_cur_result_groupby/themekey">
<gmd:keyword>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('theme'))"/>
</xsl:attribute>
<xsl:sequence select="'theme'"/>
</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<!--<xsl:call-template name="CI_Citation"/>-->
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space($var373_cur_result_groupby)"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each-group>
<xsl:for-each-group select="idinfo/keywords/place" group-by="xs:string(xs:string(placekt))">
<xsl:variable name="var378_cur_result_groupby" as="item()+" select="current-group()"/>
<xsl:variable name="var379_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="$var378_cur_result_groupby/placekey">
<gmd:keyword>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('place'))"/>
</xsl:attribute>
<xsl:sequence select="'place'"/>
</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<!--<xsl:call-template name="CI_Citation"/>-->
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space($var379_cur_result_groupby)"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each-group>
<xsl:for-each-group select="idinfo/keywords/stratum" group-by="xs:string(xs:string(stratkt))">
<xsl:variable name="var384_cur_result_groupby" as="item()+" select="current-group()"/>
<xsl:variable name="var385_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="$var384_cur_result_groupby/stratkey">
<gmd:keyword>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('stratum'))"/>
</xsl:attribute>
<xsl:sequence select="'stratum'"/>
</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space($var385_cur_result_groupby)"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each-group>
<xsl:for-each-group select="idinfo/keywords/temporal" group-by="xs:string(xs:string(tempkt))">
<xsl:variable name="var390_cur_result_groupby" as="item()+" select="current-group()"/>
<xsl:variable name="var391_cur_result_groupby" as="xs:string" select="current-grouping-key()"/>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="$var390_cur_result_groupby/tempkey">
<gmd:keyword>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('temporal'))"/>
</xsl:attribute>
<xsl:sequence select="'temporal'"/>
</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space($var391_cur_result_groupby)"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each-group>
<xsl:for-each select="idinfo/thelayid/layrname">
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<xsl:for-each select="theme/themekey">
<gmd:keyword>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:keyword>
</xsl:for-each>
<gmd:type>
<gmd:MD_KeywordTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('theme'))"/>
</xsl:attribute>
</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(xs:string(theme/themekt)))"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
</xsl:for-each>
<xsl:variable name="var399_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists(distinfo/distliab)">
<xsl:variable name="var404_map_select_distinfo" as="xs:string*">
<xsl:for-each select="distinfo">
<xsl:sequence select="xs:string(distliab)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var404_map_select_distinfo)">
<xsl:sequence select="fn:string-join($var404_map_select_distinfo, ' ')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="' '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var399_cond_result_exists">
<gmd:resourceConstraints>
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>
<xsl:value-of select="$var399_cond_result_exists"/>
</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
</xsl:for-each>
<xsl:for-each select="idinfo/useconst">
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('otherRestrictions'))"/>
</xsl:attribute>
<xsl:sequence select="'otherRestrictions'"/>
</gmd:MD_RestrictionCode>
</gmd:useConstraints>
<gmd:otherConstraints>
<gco:CharacterString>
<xsl:sequence select="normalize-space(concat ('Use Constraints: ', //idinfo/useconst))"/>
</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
</xsl:for-each>
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('otherRestrictions'))"/>
</xsl:attribute>
<xsl:sequence select="'otherRestrictions'"/>
</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:otherConstraints>
<gco:CharacterString>
<xsl:sequence select="normalize-space(concat ('Access Constraints: ', //idinfo/accconst))"/>
</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
<xsl:for-each select="idinfo/secinfo">
<gmd:resourceConstraints>
<gmd:MD_SecurityConstraints>
<xsl:if test=".//secclass">
<gmd:classification>
<xsl:variable name="var412_result_vmf13_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf13_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(secclass))))"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="var409_cond_result_exists" as="xs:string?" select="(if (fn:exists($var412_result_vmf13_inputtoresult)) then $var412_result_vmf13_inputtoresult else ())"/>
<xsl:choose>
<xsl:when test="fn:exists($var409_cond_result_exists)">
<gmd:MD_ClassificationCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ClassificationCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string($var409_cond_result_exists)"/>
</xsl:attribute>
<!--<xsl:variable name="var411_result_vmf14_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf14_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(xs:string(xs:string(secclass))))"/>
</xsl:call-template>
</xsl:variable>-->
<xsl:sequence select="$var409_cond_result_exists"/>
</gmd:MD_ClassificationCode>
</xsl:when>
<xsl:otherwise>
<xsl:comment>Security Classification not mapped to MD_ClassificationCode</xsl:comment>
<xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
<xsl:copy-of select=".//secclass"/>
<xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</gmd:classification>
</xsl:if>
<gmd:classificationSystem>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(secsys))"/>
</gco:CharacterString>
</gmd:classificationSystem>
<gmd:handlingDescription>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(sechandl))"/>
</gco:CharacterString>
</gmd:handlingDescription>
</gmd:MD_SecurityConstraints>
</gmd:resourceConstraints>
</xsl:for-each>
<xsl:for-each select="idinfo/citation/citeinfo/lworkcit/citeinfo">
<!--<xsl:variable name="var413_lworkcit" as="node()" select="."/>-->
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetName>
<xsl:call-template name="CI_Citation"/>
</gmd:aggregateDataSetName>
<gmd:associationType>
<gmd:DS_AssociationTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string(('largerWorkCitation'))"/>
</xsl:attribute>
<xsl:sequence select="'largerWorkCitation'"/>
</gmd:DS_AssociationTypeCode>
</gmd:associationType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<xsl:for-each select="idinfo/crossref/citeinfo">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetName>
<xsl:call-template name="CI_Citation"/>
</gmd:aggregateDataSetName>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="crossReference">crossReference</gmd:DS_AssociationTypeCode>
</gmd:associationType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<xsl:for-each select="idinfo/descript/documnts/datdicrf/citeinfo">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetName>
<xsl:call-template name="CI_Citation"/>
</gmd:aggregateDataSetName>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="crossReference">crossReference</gmd:DS_AssociationTypeCode>
</gmd:associationType>
<gmd:initiativeType>
<gmd:DS_InitiativeTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode" codeListValue="dataDictionary">dataDictionary</gmd:DS_InitiativeTypeCode>
</gmd:initiativeType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<xsl:for-each select="//scipap/citeinfo">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetName>
<xsl:call-template name="CI_Citation"/>
</gmd:aggregateDataSetName>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="crossReference">crossReference</gmd:DS_AssociationTypeCode>
</gmd:associationType>
<gmd:initiativeType>
<gmd:DS_InitiativeTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode" codeListValue="sciencePaper">sciencePaper</gmd:DS_InitiativeTypeCode>
</gmd:initiativeType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<xsl:for-each select="idinfo/descript/documnts/userguid/citeinfo">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetName>
<xsl:call-template name="CI_Citation"/>
</gmd:aggregateDataSetName>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="crossReference">crossReference</gmd:DS_AssociationTypeCode>
</gmd:associationType>
<gmd:initiativeType>
<gmd:DS_InitiativeTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode" codeListValue="userGuide">userGuide</gmd:DS_InitiativeTypeCode>
</gmd:initiativeType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<!--MD_AggregateInformation -->
<xsl:for-each select="//agginfo/conpckid">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetIdentifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:value-of select="normalize-space(datsetid)"/>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:aggregateDataSetIdentifier>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="largerWorkCitation">largerWorkCitation</gmd:DS_AssociationTypeCode>
</gmd:associationType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<xsl:for-each select="//agginfo/compinfo">
<gmd:aggregationInfo>
<gmd:MD_AggregateInformation>
<gmd:aggregateDataSetIdentifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>
<xsl:value-of select="normalize-space(aggmemid/datsetid)"/>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:aggregateDataSetIdentifier>
<xsl:if test="aggcrit">
<xsl:comment>Aggregration Criteria not mapped from FGDC</xsl:comment>
<xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
<xsl:copy-of select="aggcrit"/>
<xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
</xsl:if>
<gmd:associationType>
<gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="crossReference">crossReference</gmd:DS_AssociationTypeCode>
</gmd:associationType>
<gmd:initiativeType>
<gmd:DS_InitiativeTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode" codeListValue="collection">collection</gmd:DS_InitiativeTypeCode>
</gmd:initiativeType>
</gmd:MD_AggregateInformation>
</gmd:aggregationInfo>
</xsl:for-each>
<!-- spatialRepresentationType -->
<xsl:for-each select="spdoinfo/direct">
<gmd:spatialRepresentationType>
<xsl:variable name="var659_result_vmf15_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf15_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(fn:normalize-space(fn:string(.)))"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var659_result_vmf15_inputtoresult)">
<gmd:MD_SpatialRepresentationTypeCode>
<xsl:attribute name="codeList">
<xsl:sequence select="xs:string(('http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_SpatialRepresentationTypeCode'))"/>
</xsl:attribute>
<xsl:attribute name="codeListValue">
<xsl:sequence select="xs:string($var659_result_vmf15_inputtoresult)"/>
</xsl:attribute>
<xsl:sequence select="$var659_result_vmf15_inputtoresult"/>
</gmd:MD_SpatialRepresentationTypeCode>
</xsl:if>
</gmd:spatialRepresentationType>
</xsl:for-each>
<gmd:language>
<gco:CharacterString>
<xsl:sequence select="'eng; USA'"/>
</gco:CharacterString>
</gmd:language>
<xsl:for-each select="idinfo/keywords/theme">
<xsl:variable name="var661_theme" as="node()" select="."/>
<xsl:for-each select="themekey">
<xsl:variable name="var666_cond_result_contains" as="xs:boolean?">
<xsl:if test="fn:contains(xs:string(xs:string($var661_theme/themekt)), 'ISO 19115')">
<xsl:if test="fn:exists((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ()))">
<xsl:if test="((('0' != fn:normalize-space((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ()))) and ('false' != fn:normalize-space((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ())))) and fn:boolean(fn:normalize-space((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ()))))">
<xsl:sequence select="fn:true()"/>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:if test="fn:exists($var666_cond_result_contains)">
<gmd:topicCategory>
<!-- removed lower case function -->
<xsl:if test="fn:contains(xs:string(xs:string($var661_theme/themekt)), 'ISO 19115')">
<xsl:if test="fn:exists((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ()))">
<xsl:if test="not(fn:contains(fn:normalize-space((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ())), '0'))">
<gmd:MD_TopicCategoryCode>
<xsl:sequence select="fn:normalize-space((if (((('0' != xs:string($var661_theme/themekt)) and ('false' != xs:string($var661_theme/themekt))) and fn:boolean(xs:string($var661_theme/themekt)))) then xs:string(.) else ()))"/>
</gmd:MD_TopicCategoryCode>
</xsl:if>
</xsl:if>
</xsl:if>
</gmd:topicCategory>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="//idinfo/native">
<xsl:variable name="var668_native" as="node()" select="."/>
<gmd:environmentDescription>
<xsl:variable name="var670_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists($var201_metadata/distinfo/techpreq)">
<xsl:variable name="var675_map_select_distinfo" as="xs:string*">
<xsl:for-each select="$var201_metadata/distinfo/techpreq">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var675_map_select_distinfo)">
<xsl:sequence select="fn:string-join($var675_map_select_distinfo, ' ')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="' '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var670_cond_result_exists">
<gco:CharacterString>
<xsl:variable name="var673_cond_result_exists" as="xs:string" select="(if (fn:exists($var201_metadata/distinfo/techpreq)) then ' Technical Prerequisites: ' else ' ')"/>
<xsl:sequence select="fn:normalize-space(fn:string(fn:concat(fn:concat(fn:concat('Native Dataset Environment: ', xs:string($var668_native)), $var673_cond_result_exists), .)))"/>
</gco:CharacterString>
</xsl:for-each>
</gmd:environmentDescription>
</xsl:for-each>
<gmd:extent>
<gmd:EX_Extent>
<xsl:attribute name="id">
<xsl:sequence select="xs:string(xs:ID('boundingExtent'))"/>
</xsl:attribute>
<xsl:for-each select="idinfo/spdom/frarea">
<gmd:description>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(fn:concat(fn:concat(fn:concat('Frame Area: ', xs:string(xs:double(frareavl))), ' Frame Area Units: '), xs:string(xs:string(frareaun))))"/>
</gco:CharacterString>
</gmd:description>
</xsl:for-each>
<xsl:for-each select="idinfo/spdom/dsgpoly">
<xsl:variable name="var680_dsgpoly" as="node()" select="."/>
<gmd:geographicElement>
<gmd:EX_BoundingPolygon>
<gmd:polygon>
<gml:Polygon>
<xsl:attribute name="gml:id">
<xsl:sequence select="xs:string(xs:ID('boundingPolygon'))"/>
</xsl:attribute>
<gml:interior>
<gml:LinearRing>
<gml:coordinates>
<xsl:variable name="var685_map_select_grngpoin" as="xs:string*">
<xsl:for-each select="dsgpolyo/grngpoin">
<xsl:sequence select="fn:concat(fn:concat(fn:concat(xs:string(xs:double(gringlat)), ', '), xs:string(xs:double(gringlon))), '; ')"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var682_cond_result_exists" as="xs:string*">
<xsl:choose>
<xsl:when test="fn:exists($var685_map_select_grngpoin)">
<xsl:for-each select="dsgpolyo/grngpoin">
<xsl:sequence select="fn:concat(fn:concat(fn:concat(xs:string(xs:double(gringlat)), ', '), xs:string(xs:double(gringlon))), '; ')"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="dsgpolyo/gring">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var682_cond_result_exists">
<xsl:attribute name="decimal">
<xsl:sequence select="fn:normalize-space(.)"/>
</xsl:attribute>
</xsl:for-each>
</gml:coordinates>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gmd:polygon>
</gmd:EX_BoundingPolygon>
</gmd:geographicElement>
</xsl:for-each>
<xsl:if test="idinfo/spdom">
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<xsl:attribute name="id">
<xsl:sequence select="xs:string(xs:ID('boundingGeographicBoundingBox'))"/>
</xsl:attribute>
<gmd:westBoundLongitude>
<gco:Decimal>
<xsl:sequence select="xs:string((idinfo/spdom/bounding/westbc))"/>
</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>
<xsl:sequence select="xs:string((idinfo/spdom/bounding/eastbc))"/>
</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>
<xsl:sequence select="xs:string((idinfo/spdom/bounding/southbc))"/>
</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>
<xsl:sequence select="xs:string((idinfo/spdom/bounding/northbc))"/>
</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</xsl:if>
<!-- sngdate -->
<xsl:for-each select="idinfo/timeperd/timeinfo/sngdate">
<gmd:temporalElement>
<gmd:EX_TemporalExtent>
<xsl:choose>
<xsl:when test="(fn:contains(fn:lower-case(fn:normalize-space(fn:string(caldate))), 'unknown'))">
<gmd:extent gco:nilReason="unknown"/>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(./time)), 'unknown')">
<gmd:extent>
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(caldate)"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</gmd:extent>
</xsl:when>
<xsl:when test="./time">
<gmd:extent>
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(caldate)"/>
<xsl:with-param name="timeField" select="normalize-space(./time)"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</gmd:extent>
</xsl:when>
<xsl:otherwise>
<gmd:extent>
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(caldate)"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</gmd:extent>
</xsl:otherwise>
</xsl:choose>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
</xsl:for-each>
<!-- multiple single dates -->
<xsl:for-each select="idinfo/timeperd/timeinfo/mdattim/sngdate">
<gmd:temporalElement>
<gmd:EX_TemporalExtent>
<xsl:choose>
<xsl:when test="(fn:contains(fn:lower-case(fn:normalize-space(fn:string(caldate))), 'unknown'))">
<gmd:extent gco:nilReason="unknown"/>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(./time)), 'unknown')">
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="caldate"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</xsl:when>
<xsl:when test="./time">
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="caldate"/>
<xsl:with-param name="timeField" select="time"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</xsl:when>
<xsl:otherwise>
<gml:TimeInstant>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:timePosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="caldate"/>
</xsl:call-template>
</gml:timePosition>
</gml:TimeInstant>
</xsl:otherwise>
</xsl:choose>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
</xsl:for-each>
<!-- date range -->
<!-- idinfo/timeperd/timeinfo/rngdates to EX_TemporalExtent/gml:TimePeriod-->
<xsl:for-each select="idinfo/timeperd/timeinfo/rngdates">
<gmd:temporalElement>
<gmd:EX_TemporalExtent>
<xsl:attribute name="id">
<xsl:sequence select="xs:string(xs:ID('boundingTemporalExtent'))"/>
</xsl:attribute>
<gmd:extent>
<gml:TimePeriod>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="contains(lower-case(normalize-space(begdate)), 'unknown')">
<gml:beginPosition indeterminatePosition="unknown"/>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(./begtime)), 'unknown')">
<gml:beginPosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(./begdate)"/>
</xsl:call-template>
</gml:beginPosition>
</xsl:when>
<xsl:when test="./begtime">
<gml:beginPosition>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(./begdate)"/>
<xsl:with-param name="timeField" select="normalize-space(./begtime)"/>
</xsl:call-template>
</gml:beginPosition>
</xsl:when>
<xsl:otherwise>
<gml:beginPosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(begdate)"/>
</xsl:call-template>
</gml:beginPosition>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="contains(lower-case(normalize-space(enddate)), 'unknown')">
<gml:endPosition indeterminatePosition="unknown"/>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(enddate)), 'present')">
<gml:endPosition indeterminatePosition="now"/>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(./endtime)), 'unknown')">
<gml:endPosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(./enddate)"/>
</xsl:call-template>
</gml:endPosition>
</xsl:when>
<xsl:when test="(./endtime)">
<gml:endPosition>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(./enddate)"/>
<xsl:with-param name="timeField" select="normalize-space(./endtime)"/>
</xsl:call-template>
</gml:endPosition>
</xsl:when>
<xsl:otherwise>
<gml:endPosition>
<xsl:call-template name="fgdc2isoDate">
<xsl:with-param name="dateField" select="normalize-space(./enddate)"/>
</xsl:call-template>
</gml:endPosition>
</xsl:otherwise>
</xsl:choose>
</gml:TimePeriod>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
</xsl:for-each>
</gmd:EX_Extent>
</gmd:extent>
<xsl:for-each select="idinfo/descript/supplinf">
<gmd:supplementalInformation>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:supplementalInformation>
</xsl:for-each>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</xsl:for-each>
<xsl:for-each select="//bandidnt">
<gmd:contentInfo>
<xsl:comment>translated from //idinfo/bandidnt to MI_CoverageDescription</xsl:comment>
<gmi:MI_CoverageDescription>
<xsl:if test="numbands">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //idinfo/bandidnt/numbands</xsl:comment>
</xsl:if>
<gmd:attributeDescription>
<xsl:variable name="var1250_cond_result_exists" as="xs:string?" select="(if (fn:exists(inbident/bandid)) then 'Individual Band Identification' else ())"/>
<xsl:if test="fn:exists($var1250_cond_result_exists)">
<gco:RecordType>
<xsl:sequence select="$var1250_cond_result_exists"/>
</gco:RecordType>
</xsl:if>
</gmd:attributeDescription>
<gmd:contentType>
<gmd:MD_CoverageContentTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_CoverageContentTypeCode" codeListValue="image">image</gmd:MD_CoverageContentTypeCode>
</gmd:contentType>
<xsl:for-each select="inbident">
<gmd:dimension>
<gmd:MD_Band>
<gmd:sequenceIdentifier>
<gco:MemberName>
<gco:aName>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(bandid))"/>
</gco:CharacterString>
</gco:aName>
<gco:attributeType>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gco:attributeType>
</gco:MemberName>
</gmd:sequenceIdentifier>
<gmd:descriptor>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(bmmodid))"/>
</gco:CharacterString>
</gmd:descriptor>
</gmd:MD_Band>
</gmd:dimension>
</xsl:for-each>
</gmi:MI_CoverageDescription>
</gmd:contentInfo>
</xsl:for-each>
<xsl:for-each select="//eainfo/detailed">
<gmd:contentInfo>
<xsl:comment> translated from eainfo/detailed to MD_CoverageDescription</xsl:comment>
<gmd:MD_CoverageDescription>
<gmd:attributeDescription gco:nilReason="unknown"/>
<gmd:contentType gco:nilReason="unknown"/>
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //enttyp</xsl:comment>
<xsl:for-each select="//attr">
<gmd:dimension>
<gmd:MD_Band>
<gmd:sequenceIdentifier>
<gco:MemberName>
<gco:aName>
<gco:CharacterString>
<xsl:value-of select="normalize-space(attrlabl)"/>
</gco:CharacterString>
</gco:aName>
<gco:attributeType gco:nilReason="unknown"/>
</gco:MemberName>
</gmd:sequenceIdentifier>
<gmd:descriptor>
<gco:CharacterString>
<xsl:value-of select="normalize-space(./attrdef)"/>
</gco:CharacterString>
</gmd:descriptor>
<xsl:choose>
<xsl:when test="attrdomv/rdom">
<gmd:maxValue>
<gco:Real>
<xsl:value-of select="./attrdomv/rdom/rdommax"/>
</gco:Real>
</gmd:maxValue>
<gmd:minValue>
<gco:Real>
<xsl:value-of select="./attrdomv/rdom/rdommin"/>
</gco:Real>
</gmd:minValue>
<gmd:units>
<gml:UnitDefinition>
<xsl:attribute name="gml:id">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<gml:identifier codeSpace="local">
<xsl:value-of select="normalize-space(./attrdomv/rdom/attrunit)"/>
</gml:identifier>
<gml:name>
<xsl:value-of select="normalize-space(./attrdomv/rdom/attrunit)"/>
</gml:name>
</gml:UnitDefinition>
</gmd:units>
</xsl:when>
<xsl:when test="attrdomv/edom">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //attrdomv/edom</xsl:comment>
</xsl:when>
<xsl:when test="attrdomv/codesetd">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //attrdomv/codesetd</xsl:comment>
</xsl:when>
<xsl:when test="attrdomv/datascal">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //attrdomv/datascal</xsl:comment>
</xsl:when>
<xsl:when test="attrdomv/udom">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //attrdomv/udom</xsl:comment>
</xsl:when>
</xsl:choose>
</gmd:MD_Band>
</gmd:dimension>
</xsl:for-each>
</gmd:MD_CoverageDescription>
</gmd:contentInfo>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata/eainfo">
<xsl:variable name="var1166_eainfo" as="node()" select="."/>
<gmd:contentInfo>
<xsl:comment> translated from eainfo to MD_FeatureCatalogueDescription</xsl:comment>
<gmd:MD_FeatureCatalogueDescription>
<gmd:includedWithDataset>
<gco:Boolean>
<xsl:variable name="var1168_cond_result_exists" as="xs:decimal" select="(if (fn:exists(detailed)) then xs:decimal(1) else xs:decimal(0))"/>
<xsl:sequence select="xs:string(fn:boolean($var1168_cond_result_exists))"/>
</gco:Boolean>
</gmd:includedWithDataset>
<xsl:for-each select="detailed">
<gmd:featureTypes>
<gco:LocalName>
<xsl:attribute name="codeSpace">
<xsl:sequence select="xs:string((fn:normalize-space(xs:string(enttyp/enttypl))))"/>
</xsl:attribute>
</gco:LocalName>
</gmd:featureTypes>
</xsl:for-each>
<gmd:featureCatalogueCitation>
<xsl:variable name="var1171_cond_result_exists" as="xs:decimal" select="(if (fn:exists(detailed)) then xs:decimal(1) else xs:decimal(0))"/>
<xsl:if test="fn:exists((if ((xs:string($var1171_cond_result_exists) = 'false')) then () else 'unknown'))">
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string((if ((xs:string($var1171_cond_result_exists) = 'false')) then () else 'unknown')))"/>
</xsl:attribute>
</xsl:if>
<xsl:variable name="var1172_cond_result_exists" as="xs:string?" select="(if (fn:exists(overview/eaover)) then 'Entity and Attribute Overview: ' else ())"/>
<xsl:if test="fn:exists($var1172_cond_result_exists)">
<xsl:variable name="var1173_cond_result_exists" as="xs:string?">
<xsl:if test="fn:exists(overview/eaover)">
<xsl:variable name="var1185_map_select_overview" as="xs:string*">
<xsl:for-each select="overview">
<xsl:sequence select="xs:string(eaover)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var1185_map_select_overview)">
<xsl:sequence select="fn:string-join($var1185_map_select_overview, ' ')"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:for-each select="$var1173_cond_result_exists">
<xsl:variable name="var1174_cur_cond_result_exists" as="xs:string" select="."/>
<xsl:variable name="var1176_cond_result_exists" as="xs:string?" select="(if (fn:exists($var1166_eainfo/overview/eadetcit)) then ' Entity and Attribute Detail Citation: ' else ())"/>
<xsl:if test="fn:exists($var1176_cond_result_exists)">
<xsl:variable name="var1177_cond_result_exists" as="xs:string?">
<xsl:if test="fn:exists($var1166_eainfo/overview/eadetcit)">
<xsl:variable name="var1181_map_select_overview" as="xs:string*">
<xsl:for-each select="$var1166_eainfo/overview/eadetcit">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var1181_map_select_overview)">
<xsl:sequence select="fn:string-join($var1181_map_select_overview, ' ')"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:for-each select="$var1177_cond_result_exists">
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>
<xsl:sequence select="'Entity and Attribute Information'"/>
</gco:CharacterString>
</gmd:title>
<gmd:date>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string(xs:string('unknown'))"/>
</xsl:attribute>
</gmd:date>
<gmd:otherCitationDetails>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(fn:concat(fn:concat(fn:concat($var1172_cond_result_exists, $var1174_cur_cond_result_exists), $var1176_cond_result_exists), .))"/>
</gco:CharacterString>
</gmd:otherCitationDetails>
</gmd:CI_Citation>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:if>
</gmd:featureCatalogueCitation>
</gmd:MD_FeatureCatalogueDescription>
</gmd:contentInfo>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata">
<xsl:variable name="var1188_metadata" as="node()" select="."/>
<xsl:for-each select="dataqual/cloud">
<gmd:contentInfo>
<xsl:comment>translated from dataqual/cloud to MD_ImageDescription</xsl:comment>
<gmd:MD_ImageDescription>
<gmd:attributeDescription gco:nilReason="inapplicable"/>
<gmd:contentType gco:nilReason="inapplicable"/>
<gmd:cloudCoverPercentage>
<xsl:if test="fn:contains(fn:lower-case(xs:string(xs:string(.))), 'unknown')">
<xsl:attribute name="gco:nilReason">
<xsl:value-of select="'unknown'"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="not(fn:contains(fn:lower-case(xs:string(xs:string(.))), 'unknown'))">
<gco:Real>
<xsl:sequence select="xs:string((xs:string(.)))"/>
</gco:Real>
</xsl:if>
</gmd:cloudCoverPercentage>
</gmd:MD_ImageDescription>
</gmd:contentInfo>
</xsl:for-each>
<xsl:for-each select="$var1188_metadata/idinfo/proclevl">
<xsl:variable name="var1192_proclevl" as="node()" select="."/>
<gmd:contentInfo>
<gmd:MD_ImageDescription>
<gmd:attributeDescription gco:nilReason="inapplicable"/>
<gmd:contentType gco:nilReason="inapplicable"/>
<gmd:processingLevelCode>
<gmd:MD_Identifier>
<xsl:for-each select="prolevau/citeinfo">
<gmd:authority>
<xsl:call-template name="CI_Citation"/>
</gmd:authority>
</xsl:for-each>
<gmd:code>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(prolevid))"/>
</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:processingLevelCode>
</gmd:MD_ImageDescription>
</gmd:contentInfo>
</xsl:for-each>
</xsl:for-each>
<!-- MD_Distribution -->
<xsl:if test="//distinfo">
<gmd:distributionInfo>
<gmd:MD_Distribution>
<xsl:for-each select="$var1_instance/metadata/distinfo/stdorder/digform">
<xsl:variable name="var1253_digform" as="node()" select="."/>
<!-- distributionFormat -->
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(digtinfo/formname)"/>
</gco:CharacterString>
</gmd:name>
<gmd:version>
<xsl:choose>
<!-- formverd added by ted.habermann@noaa.gov 2012-04-28 -->
<xsl:when test="./digtinfo/formvern or ./digtinfo/formverd">
<gco:CharacterString>
<xsl:value-of select="normalize-space(concat(./digtinfo/formvern,' ',./digtinfo/formverd))"/>
</gco:CharacterString>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="'unknown'"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</gmd:version>
<xsl:for-each select="digtinfo/formspec">
<gmd:specification>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:specification>
</xsl:for-each>
<xsl:for-each select="digtinfo/filedec">
<gmd:fileDecompressionTechnique>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(xs:string(.)))"/>
</gco:CharacterString>
</gmd:fileDecompressionTechnique>
</xsl:for-each>
</gmd:MD_Format>
</gmd:distributionFormat>
</xsl:for-each>
<xsl:for-each select="$var1_instance/metadata/distinfo">
<xsl:variable name="var1276_distinfo" as="node()" select="."/>
<!-- distributor -->
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<xsl:call-template name="CI_ResponsibleParty">
<xsl:with-param name="role">distributor</xsl:with-param>
</xsl:call-template>
</gmd:distributorContact>
<xsl:for-each select="stdorder">
<xsl:variable name="var1322_stdorder" as="node()" select="."/>
<gmd:distributionOrderProcess>
<gmd:MD_StandardOrderProcess>
<xsl:if test=".//resdesc">
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //distinfo/stdorder/resdesc</xsl:comment>
</xsl:if>
<gmd:fees>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(fees))"/>
</gco:CharacterString>
</gmd:fees>
<xsl:for-each select="//distinfo/availabl">
<!-- time period -->
<gmd:plannedAvailableDateTime>
<xsl:choose>
<!-- sngDate -->
<xsl:when test=".//sngdate">
<xsl:choose>
<xsl:when test="(fn:contains(fn:lower-case(fn:normalize-space(fn:string(timeinfo/sngdate/caldate))), 'unknown'))">
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string('unknown')"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(timeinfo/sngdate/time)), 'unknown')">
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/sngdate/caldate)"/>
<xsl:with-param name="timeField" select="'00:00:00'"/>
</xsl:call-template>
</gco:DateTime>
</xsl:when>
<xsl:when test="normalize-space(timeinfo/sngdate/time)">
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/sngdate/caldate)"/>
<xsl:with-param name="timeField" select="normalize-space(timeinfo/sngdate/time)"/>
</xsl:call-template>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/sngdate/caldate)"/>
<xsl:with-param name="timeField" select="'00:00:00'"/>
</xsl:call-template>
</gco:DateTime>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test=".//rngdates">
<xsl:choose>
<xsl:when test="(fn:contains(fn:lower-case(fn:normalize-space(fn:string(timeinfo/rngdates/begdate))), 'unknown'))">
<xsl:attribute name="gco:nilReason">
<xsl:sequence select="xs:string('unknown')"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="contains(lower-case(normalize-space(timeinfo/rngdates/begtime)), 'unknown')">
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/rngdates/begdate)"/>
<xsl:with-param name="timeField" select="'00:00:00'"/>
</xsl:call-template>
</gco:DateTime>
</xsl:when>
<xsl:when test="normalize-space(timeinfo/rngdates/begtime)">
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/rngdates/begdate)"/>
<xsl:with-param name="timeField" select="normalize-space(timeinfo/rngdates/begtime)"/>
</xsl:call-template>
</gco:DateTime>
</xsl:when>
<xsl:otherwise>
<gco:DateTime>
<xsl:call-template name="fgdc2isoDateTime">
<xsl:with-param name="dateField" select="normalize-space(timeinfo/rngdates/begdate)"/>
<xsl:with-param name="timeField" select="'00:00:00'"/>
</xsl:call-template>
</gco:DateTime>
<xsl:comment>FGDC content not mapped to ISO. From Xpath: //distinfo/availabl/timeinfo/rngdates/enddate</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</gmd:plannedAvailableDateTime>
</xsl:for-each>
<xsl:for-each select="ordering">
<xsl:variable name="var1705_ordering" as="node()" select="."/>
<gmd:orderingInstructions>
<xsl:variable name="var1707_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="fn:exists($var1322_stdorder/digform/digtopt/onlinopt/accinstr)">
<xsl:variable name="var1722_map_select_digform" as="xs:string*">
<xsl:for-each select="$var1322_stdorder/digform/digtopt/onlinopt/accinstr">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var1722_map_select_digform)">
<xsl:sequence select="fn:string-join($var1722_map_select_digform, ' ')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="' '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var1707_cond_result_exists">
<xsl:variable name="var1710_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="$var1322_stdorder/nondig">
<xsl:for-each select="$var1322_stdorder/nondig">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="' '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="fn:exists($var1710_cond_result_exists)">
<xsl:variable name="var1711_cond_result_exists" as="xs:string?">
<xsl:choose>
<xsl:when test="$var1276_distinfo/custom">
<xsl:for-each select="$var1276_distinfo/custom">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="' '"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="fn:exists($var1711_cond_result_exists)">
<gco:CharacterString>
<xsl:variable name="var1712_cond_result_exists" as="xs:string" select="(if (fn:exists($var1322_stdorder/digform/digtopt/onlinopt/accinstr)) then 'Access Instructions: ' else ' ')"/>
<xsl:variable name="var1713_cond_result_exists" as="xs:string" select="(if (fn:exists($var1322_stdorder/nondig)) then 'Non-Digital Form: ' else ' ')"/>
<xsl:variable name="var1714_cond_result_exists" as="xs:string" select="(if (fn:exists($var1276_distinfo/custom)) then ' Custom Order Process: ' else ' ')"/>
<xsl:sequence select="fn:normalize-space(fn:string(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat(fn:concat($var1712_cond_result_exists, .), $var1713_cond_result_exists), ' '), $var1710_cond_result_exists), ' '), 'Ordering Instructions: '), ' '), xs:string($var1705_ordering)), $var1714_cond_result_exists), $var1711_cond_result_exists)))"/>
</gco:CharacterString>
</xsl:if>
</xsl:if>
</xsl:for-each>
</gmd:orderingInstructions>
</xsl:for-each>
<xsl:for-each select="turnarnd">
<gmd:turnaround>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(fn:normalize-space(xs:string(.)))"/>
</gco:CharacterString>
</gmd:turnaround>
</xsl:for-each>
</gmd:MD_StandardOrderProcess>
</gmd:distributionOrderProcess>
</xsl:for-each>
</gmd:MD_Distributor>
</gmd:distributor>
</xsl:for-each>
<xsl:if test="//stdorder//onlinopt">
<!-- transferOptions -->
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<xsl:for-each select="$var1_instance/metadata/distinfo/stdorder/digform/digtinfo/transize">
<gmd:transferSize>
<gco:Real>
<xsl:sequence select="xs:string(.)"/>
</gco:Real>
</gmd:transferSize>
</xsl:for-each>
<xsl:choose>
<xsl:when test="//stdorder//formname">
<xsl:for-each select="//stdorder/digform">
<gmd:onLine>
<xsl:call-template name="CI_OnlineResource">
<xsl:with-param name="source" select="'digform'"/>
</xsl:call-template>
</gmd:onLine>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="//networka/CI_OnlineResource">
<gmd:onLine>
<xsl:call-template name="CI_OnlineResource">
<xsl:with-param name="source" select="'CI_OnlineResource'"/>
</xsl:call-template>
</gmd:onLine>
</xsl:for-each>
<xsl:for-each select="//networka/networkr">
<gmd:onLine>
<xsl:call-template name="CI_OnlineResource">
<xsl:with-param name="source" select="'networkr'"/>
</xsl:call-template>
</gmd:onLine>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<!--<xsl:variable name="networkr" as="xs:string*">
<xsl:for-each select="$var1_instance/metadata/distinfo/stdorder/digform/digtopt/onlinopt/computer/networka/networkr">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:variable>-->
<!--<xsl:for-each select="fn:distinct-values($networkr)">
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>
<xsl:sequence select="xs:string(fn:normalize-space(.))"/>
</gmd:URL>
</gmd:linkage>
<xsl:for-each select="$var1_instance/metadata/distinfo/stdorder/digform/digtopt/onlinopt/oncomp">
<gmd:description>
<gco:CharacterString>
<xsl:sequence select="fn:normalize-space(xs:string(.))"/>
</gco:CharacterString>
</gmd:description>
</xsl:for-each>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:for-each>-->
<!--<xsl:for-each select="$var1_instance/metadata/idinfo/citation/citeinfo/onlink">
<xsl:comment>URL mapped from fgdc xpath: //idinfo/citation/citeinfo/onlink</xsl:comment>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<xsl:for-each select="fn:distinct-values(xs:string(.))">
<gmd:URL>
<xsl:sequence select="xs:string(fn:normalize-space(.))"/>
</gmd:URL>
</xsl:for-each>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onLine>
</xsl:for-each>-->
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</xsl:if>
<xsl:for-each-group select="$var1_instance/metadata/distinfo/stdorder/digform/digtopt/offoptn" group-by="xs:string(xs:string(offmedia))">
<xsl:variable name="var1741_cur_result_groupby" as="item()+" select="current-group()"/>
<!-- transferOptions -->
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:offLine>
<gmd:MD_Medium>
<gmd:name>
<xsl:variable name="var1781_map_result_groupitems" as="xs:string+">
<xsl:for-each select="$var1741_cur_result_groupby">
<xsl:sequence select="fn:normalize-space(xs:string(xs:string(offmedia)))"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var1780_map_result_distinctvalues" as="xs:string*">
<xsl:for-each select="fn:distinct-values($var1781_map_result_groupitems)">
<xsl:variable name="var1784_result_vmf17_inputtoresult" as="xs:string?">
<xsl:call-template name="vmf:vmf17_inputtoresult">
<xsl:with-param name="input" select="fn:upper-case(.)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="fn:exists($var1784_result_vmf17_inputtoresult)">
<xsl:sequence select="$var1784_result_vmf17_inputtoresult"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var1771_cond_result_exists" as="xs:string?" select="(if (fn:exists($var1780_map_result_distinctvalues)) then fn:string-join($var1780_map_result_distinctvalues, ' ') else ())"/>
<xsl:variable name="var1744_cond_result_exists" as="xs:string?">
<xsl:if test="$var1771_cond_result_exists">
<xsl:variable name="var1774_map_result_groupitems" as="xs:string+">
<xsl:for-each select="$var1741_cur_result_groupby">
<xsl:sequence select="