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

<xsl:template name="distinfo" match="/">

<xsl:if test="//distinfo">

<xsl:element name="Contact_Organization"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntorgp/cntorg"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Address_Type"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>mailing</xsl:element>

<xsl:element name="Address"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntaddr/address"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="City"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntaddr/city"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="State_or_Province"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntaddr/state"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Postal_Code"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntaddr/postal"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Country"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntaddr/country"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Contact_Voice_Telephone"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntvoice"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Contact_Facsimile_Telephone"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntfax"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Contact_Electronic_Mail_Address"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:apply-templates select="//distinfo/distrib/cntinfo/cntemail"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Resource_Description"> <!-- mif name -->
<xsl:apply-templates select="//distinfo/resdesc"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Distribution_Liability"> <!-- mif name -->
<xsl:apply-templates select="//distinfo/distliab"/> <!-- FGDC path -->
</xsl:element>

<xsl:if test="//distinfo/stdorder/nondig">
<xsl:element name="Non-Digital_Form"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtinfo/formname"/> <!-- FGDC path -->
</xsl:element>
</xsl:if>

<xsl:if test="//distinfo/stdorder/digform">

<xsl:element name="Format_Name"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtinfo/formname"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="File_Decompression_Technique"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtinfo/filedec"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Transfer_Size"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtinfo/transize"/> <!-- FGDC path -->
</xsl:element>

<xsl:if test="//distinfo/stdorder/digform/digtopt/onlinopt">

<xsl:element name="Network_Resource_Name"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:attribute name ="gid3">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtopt/onlinopt/computer/networka/networkr"/> <!-- FGDC path -->
</xsl:element>

</xsl:if>

<xsl:if test="//distinfo/stdorder/digform/digtopt/offoptn">

<xsl:element name="Offline_Media"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/digform/digtopt/offoptn/offmedia"/> <!-- FGDC path -->
</xsl:element>

<xsl:for-each select="//distinfo/stdorder/digform/digtopt/offoptn/recfmt">
<xsl:element name="Recording_Format"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:attribute name ="gid2">1</xsl:attribute>
<xsl:apply-templates select="."/> <!-- FGDC path -->
</xsl:element>
</xsl:for-each>

</xsl:if>

</xsl:if>

<xsl:element name="Fees"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/fees"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Ordering_Instructions"> <!-- mif name -->
<xsl:attribute name ="section">distributor</xsl:attribute>
<xsl:attribute name ="gid1">1</xsl:attribute>
<xsl:apply-templates select="//distinfo/stdorder/ordering"/> <!-- FGDC path -->
</xsl:element>

<xsl:element name="Technical_Prerequisites"> <!-- mif name -->
<xsl:apply-templates select="//distinfo/techpreq"/> <!-- FGDC path -->
</xsl:element>

</xsl:if> <!-- distinfo -->
</xsl:template>
</xsl:stylesheet>
