<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
   Name:  IdentificationInformation.xsl
   Author:  James W. Allor
   Date:  20051128
   Description:  This is the XSLT stylesheet that transforms a MIF (Metadata
                 Import Format) document to the (MRF Metadata Repository 
                 Format). It does this by calling seven stylesheets that 
                 correspond to GPMS section headings. Since the sections 
                 included in the MRF vary by profile, it first checks for
                 the existence of required elements in the MIF for that 
                 section before calling the corresponding stylesheet.

   Modification History:
      Initials   Date      Change Req. ID    Description
      JWA       20051128    N/A               Initial Version 
-->


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>

<xsl:include href="../xsl/IdentificationInformation.xsl"/>
<xsl:include href="../xsl/DataQualityInformation.xsl"/>
<xsl:include href="../xsl/SpatialDataOrganizationInformation.xsl"/>
<xsl:include href="../xsl/SpatialReferenceInformation.xsl"/>
<xsl:include href="../xsl/EntityAndAttributeInformation.xsl"/>
<xsl:include href="../xsl/DistributionInformation.xsl"/>
<xsl:include href="../xsl/MetadataReferenceInformation.xsl"/>


<xsl:template match="/">
  <xsl:result-document validation="strict">
    <xsl:apply-templates/>
  </xsl:result-document>
</xsl:template>


<xsl:template match="MIF">

  <xsl:element name="MRF">

    <xsl:namespace name="xsi" select="'http://www.w3.org/2001/XMLSchema-instance'"/>

    <xsl:variable name="profile_type" select="@profile_type"/>
    <xsl:attribute name="profile_type">
      <xsl:value-of select="@profile_type"/>
    </xsl:attribute>
    <xsl:attribute namespace="http://www.w3.org/2001/XMLSchema-instance" 
                   name="xsi:noNamespaceSchemaLocation">
      <xsl:value-of select="concat( '/mt/apps/gpms/xsd/', 
                            upper-case( substring($profile_type,1,1) ), 
                            substring($profile_type,2), '.xsd' )"/>
    </xsl:attribute>       
 
    <xsl:if test="/MIF/Originator[@section='citation']">
      <xsl:call-template name="Identification_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Attribute_Accuracy_Report">
      <xsl:call-template name="Data_Quality_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Indirect_Spatial_Reference">
      <xsl:call-template name="Spatial_Data_Organization_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Horizontal_Datum_Name">
      <xsl:call-template name="Spatial_Reference_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Entity_Type_Label or
                  /MIF/Entity_and_Attribute_Overview">
      <xsl:call-template name="Entity_and_Attribute_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Contact_Organization[@section='distributor']">
      <xsl:call-template name="Distribution_Information"/>
    </xsl:if>

    <xsl:if test="/MIF/Metadata_Date">
      <xsl:call-template name="Metadata_Reference_Information"/>
    </xsl:if>

  </xsl:element>
</xsl:template>

</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios/><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->
