<?xml version="1.0" encoding="utf-8"?>
<!--
   Name:  tc_MRF2FGDC.xsl
   Author:  Tracy Corder
   Date:  20060704
   Description:  This is the XSLT stylesheet that transforms a MRF (Metadata
                 RXXXXX Format) document to the FGDC format(Federal Geographic
                 Data Committee). 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 MRF for that
                 section before calling the corresponding stylesheet.

   Modification History:
      Initials      Date      Change Req. ID       Description
      TC          20060704      N/A                  Initial Version

   REFERENCES:
      Metadata Parser = http://geo-nsdi.er.usgs.gov/validate.php
      FGDC Metadata Standard = http://www.fgdc.gov/metadata/csdgm/
      Saxon Parser = http://www.saxonica.com/

   SAXON NOTES:
      ADD TO CLASSPATH - C:\saxon\saxon873\saxon8.jar;
      ADD TO PATH - C:\Program Files\Java\jdk1.5.0_04\bin\;

      A command is available to apply a given stylesheet to a given source XML document. The form of command on the Java platform is:

      java  net.sf.saxon.Transform   [options]   source-document   stylesheet   [ params...]

      For the .NET platform, the command is simply:

      Transform   [options]   source-document   stylesheet   [ params...]

      For a schema-aware transformation, specify the option -sa, or (on the Java platform only) use the alternate entry point com.saxonica.Transform. For more details see Schema-Aware Transformations.

      The options must come first, then the two file names, then the params. The stylesheet is omitted if the -a option is present.

      For this to work, all the necessary Java components must be available on the classpath. See Installation for details of how to set up the classpath.

      If you are are not using any additional Java libraries, you can use the simpler form of command:

      java  -jar dir/saxon8.jar   [options]   source-document   stylesheet   [ params...]

      Note, however, that this does not work if you need to load user-written extension functions or other classes from the classpath. It will therefore not work if your stylesheet uses extension functions, or if you are using other modules such as the Saxon JDOM or XOM interfaces. It also does not work if you are using Saxon-SA, because the license file needs to be on the classpath.
-->

<xsl:stylesheet
   version="2.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

   <xsl:import href="01_Identification_Information.xsl"/>
   <xsl:import href="02_Data_Quality_Information.xsl"/>
   <xsl:import href="03_Spatial_Data_Organization_Information.xsl"/>
   <xsl:import href="04_Spatial_Reference_Information.xsl"/>
   <xsl:import href="05_Entity_And_Attribute_Information.xsl"/>
   <xsl:import href="06_Distribution_Information.xsl"/>
   <xsl:import href="07_Metadata_Reference_Information.xsl"/>

   <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>

   <xsl:strip-space elements="*"/>

   <xsl:template match="/">
     <xsl:element name="metadata">
       <xsl:if test="/MRF/Identification_Information">
         <xsl:call-template name="Identification_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Data_Quality_Information">
         <xsl:call-template name="Data_Quality_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Spatial_Data_Organization_Information">
         <xsl:call-template name="Spatial_Data_Organization_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Spatial_Reference_Information">
         <xsl:call-template name="Spatial_Reference_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Entity_and_Attribute_Information">
         <xsl:call-template name="Entity_and_Attribute_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Distribution_Information">
         <xsl:call-template name="Distribution_Information" />
       </xsl:if>
       <xsl:if test="/MRF/Metadata_Reference_Information">
         <xsl:call-template name="Metadata_Reference_Information" />
       </xsl:if>
     </xsl:element>
   </xsl:template>

</xsl:stylesheet>
