<?xml version="1.0" encoding="UTF-8" ?>

<!--
   Name:  MD_ProgressCode.xsl 
   Author:  Matthew J. McCready
   Date:  20110608
   Description:  XSLT stylesheet that transforms the value in the  timeperd/current (Currentness Reference) element into
  the correct MD_ProgressCode codeList value ,which can be found of page 100 of the ISO standard, for the gmd:MD_ProgressCode ISO element and the 
 codeListValue and codeSpace attributes. This stylesheet is called by the 11_gmd:identificationInfo.xsl
   Modification History:
      Initial   Date      Change Request ID   Description

-->


<!-- <xsl:import href="../IsoSchema/18_gmdTemplate1.xsl"/> -->

<!-- <xsl:include href="../IsoSchema/18_gmdTemplate1.xsl"/>
<xsl:import href="../IsoSchema/19_gmdTemplate2.xsl"/>
<xsl:import href="../IsoSchema/20_gmdTemplate3.xsl"/>
<xsl:import href="../IsoSchema/21_gmdTemplate4.xsl"/>
<xsl:import href="../IsoSchema/22_gmdFunctions.xsl"/> -->


<xsl:stylesheet version = "1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:gmd="http://www.isotc211.org/2005/gmd"
   xmlns:gco="http://www.isotc211.org/2005/gco" 
>
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>
<xsl:variable name ="MetDate"   select= "//metadata/metainfo/metd"/>
<!-- <xsl:variable name="SDTSPntVot" select="//metadata/spdoinfo/ptvctinf/sdtsterm/sdtstype"/> -->



<xsl:template name="MD_ProgressCode">
<xsl:variable name="CodeListLoc">http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ProgressCode</xsl:variable>
<xsl:variable name="ProgressCode" select="//metadata/idinfo/status/progress"/>
<xsl:choose>
<xsl:when test="$ProgressCode='Complete'">
	<xsl:element name="gmd:status">
		<xsl:element name="gmd:MD_ProgressCode">
			<xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
			<xsl:attribute name="codeListValue">completed</xsl:attribute>
			<xsl:attribute name="codeSpace">001 </xsl:attribute>
                         completed
		</xsl:element><!-- gmd:CI_PresentationFormCode -->
	</xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='Completed'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">completed</xsl:attribute>
                        <xsl:attribute name="codeSpace">001 </xsl:attribute>
                         completed
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='Archived'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">historicalArchive</xsl:attribute>
                        <xsl:attribute name="codeSpace">002 </xsl:attribute>
                         historicalArchive
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='archived'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">historicalArchive</xsl:attribute>
                        <xsl:attribute name="codeSpace">002 </xsl:attribute>
                         historicalArchive
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>

<xsl:when test="$ProgressCode='Obsolete'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">obsolete</xsl:attribute>
                        <xsl:attribute name="codeSpace">003</xsl:attribute>
                         obsolete
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='obsolete'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">obsolete</xsl:attribute>
                        <xsl:attribute name="codeSpace">003</xsl:attribute>
                         obsolete
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>

<xsl:when test="$ProgressCode='On going'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">onGoing</xsl:attribute>
                        <xsl:attribute name="codeSpace">004</xsl:attribute>
                         onGoing
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='on going'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">onGoing</xsl:attribute>
                        <xsl:attribute name="codeSpace">004</xsl:attribute>
                         onGoing
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='Continually'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">onGoing</xsl:attribute>
                        <xsl:attribute name="codeSpace">004</xsl:attribute>
                         onGoing 
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='continually'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">onGoing</xsl:attribute>
                        <xsl:attribute name="codeSpace">004</xsl:attribute>
                         onGoing
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='Planned'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">planned</xsl:attribute>
                        <xsl:attribute name="codeSpace">005</xsl:attribute>
                         planned
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='planned'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">planned</xsl:attribute>
                        <xsl:attribute name="codeSpace">005</xsl:attribute>
                         planned
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='Required'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">required</xsl:attribute>
                        <xsl:attribute name="codeSpace">006</xsl:attribute>
                      required  
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='required'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">required</xsl:attribute>
                        <xsl:attribute name="codeSpace">006</xsl:attribute>
                         required
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='In progress'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">underDevelopment</xsl:attribute>
                        <xsl:attribute name="codeSpace">007</xsl:attribute>
                         required
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='in progress'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">underDevelopment</xsl:attribute>
                        <xsl:attribute name="codeSpace">007</xsl:attribute>
                         required
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='In work'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">underDevelopment</xsl:attribute>
                        <xsl:attribute name="codeSpace">007</xsl:attribute>
                         required
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>
<xsl:when test="$ProgressCode='in work'">
        <xsl:element name="gmd:status">
                <xsl:element name="gmd:MD_ProgressCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">underDevelopment</xsl:attribute>
                        <xsl:attribute name="codeSpace">007</xsl:attribute>
                         required
                </xsl:element><!-- gmd:CI_PresentationFormCode -->
        </xsl:element><!-- gmd:presentationForm -->
</xsl:when>



</xsl:choose>
</xsl:template>
</xsl:stylesheet>
