<?xml version="1.0" encoding="UTF-8"?>
<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"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
    <xd:doc scope="stylesheet">
        <xd:desc>
            <xd:p><xd:b>Created on:</xd:b> Oct 30, 2013</xd:p>
            <xd:p><xd:b>Author:</xd:b> mccre004</xd:p>
            <xd:p/>
        </xd:desc>
    </xd:doc>

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


    <xsl:template name="MD_MediumNameCode">
        <xsl:variable name="CodeListLoc"
            >http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MediumNameCode</xsl:variable>
        <xsl:variable name="MediumNameCode"
            select="/metadata/distinfo/stdorder/digform/digtopt/offoptn/offmedia"/>

        <xsl:choose>
            <xsl:when test="$MediumNameCode='DVD-ROM (Only if offered offline)'">
                <xsl:element name="gmd:name">


                    <xsl:element name="gmd:MD_MediumNameCode">
                        <xsl:attribute name="codeList"><xsl:value-of select="$CodeListLoc"/></xsl:attribute>
                        <xsl:attribute name="codeListValue">dvdRom</xsl:attribute>
                        <xsl:attribute name="codeSpace">003</xsl:attribute> dvdRom </xsl:element>
                </xsl:element>
            </xsl:when>
        </xsl:choose>

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