<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <!-- =============================================================== -->
  <!-- emne-edit.xsl (v001) -                                          -->
  <!-- Opprettet 20.02.2005 - Tomm Eriksen (t.a.eriksen@usit.uio.no)   -->
  <!-- =============================================================== -->

  <xsl:import href="../../../system/system-edit-v001.xsl"/>

  <!-- Spesielt for studie-dokumenter -->
  <xsl:include href="../../ressurser/translations-v001.xsl"/>
  <xsl:include href="../../ressurser/mapping-v001.xsl"/>

  <!-- Må inkluderes for dokumenter med fellestekster -->
  <xsl:include href="../../ressurser/hent-fellestekst-v001.xsl"/>
  
  <!-- Inkluderte komponenter -->
  <xsl:include href="../../../felles/komponenter/fritekst/v002/fritekst-edit.xsl"/>
  <xsl:include href="../../komponenter/spraak/v001/spraak-edit.xsl"/>
  <xsl:include href="../../komponenter/adresse/v001/adresse-edit.xsl"/>
  <xsl:include href="../../komponenter/hent-ekstern-adresse/v001/hent-ekstern-adresse-edit.xsl"/>
  <xsl:include href="../../komponenter/weblenke/v001/weblenke-edit.xsl"/>

  <xsl:include href="../../../felles/komponenter/dato/v001/dato-edit.xsl"/>
  <xsl:include href="../../komponenter/semester/v001/semester-edit.xsl"/>

  <xsl:variable name="FELLESTEKST" select="document('/vrtx/fellestekster/emne.xml')"/>

  <!-- =============================================================== -->
  <!-- Templates som kalles i system-edit.xsl og som kan overstyres.   -->
  <!-- Se avsnitt "Template name API" i system-edit.xsl for oversikt   -->
  <!-- over disse.                                                     -->
  <!-- =============================================================== -->

  <!-- Definerer hvorvidt system-edit skal legge på "Rediger <elementnavn>" -->
  <!-- på toppnivå-elementer eller ikke -->
  <xsl:variable name="label-toplevel-elements" select="'no'" />

  <!-- Definer det statiske elementet rett før de flyttbare elementene -->
  <xsl:variable name="movable-or-deletable-elements-after" select="''" />

  <!-- DTD-syntaks for flyttbare og slettbare elementer (men ikke bruk mellomrom)-->
  <xsl:variable name="movable-or-deletable-elements" select="''" />

  <!-- css-klasser kan som brukes i denne dok. typen kan legges inn her -->
  <xsl:template name="css-classes">
    h1 {font-size: 150%;font-weight: bold;display:inline;}
    h2 {font-size: 130%;font-weight: bold;display:inline;}
    h3 {font-size: 115%;font-weight: bold;display:inline;}
    h4 {font-size: 100%;font-weight: bold;display:inline;}
    p {display:block;}
  </xsl:template>

  <!-- shortcuts for å sette inn elementer nederst spesifiseres i denne -->
  <!-- se evt. pensumliste-edit.xsl for eksempel. -->
  <xsl:template name="shortcutlinks-put-bottom">
  </xsl:template>
  
  <!-- =============================================================== -->
  <!-- Templater for visning av elementer under redigering             -->
  <!-- =============================================================== -->

  <xsl:template match="tittel">
    <h1><xsl:value-of select="emnenavn"/> (<xsl:value-of select="emnekode"/>)</h1>&#160;<xsl:call-template name="insert-edit-link"/>
  </xsl:template>

  <xsl:template match="emnenavn|emnekode"/>

  <xsl:template match="studiepoeng">
     <b><xsl:value-of select="name()"/>:</b>&#160;<xsl:value-of select="."/>&#160;<xsl:call-template name="insert-edit-link"/>
  </xsl:template>

  <xsl:template match="undervisningssemester|eksamenssemester|undervisningsspraak|emnetype|status">
    <b><xsl:value-of select="name()"/>:</b>&#160;<xsl:value-of select="@*"/>&#160;<xsl:call-template name="insert-edit-link"/>
  </xsl:template>

  <!-- Kategorisering på tema utgår i 1. omgang -->

  <!-- xsl:template match="primaerkategori">
    <b>primærkategori:</b>&#160;<xsl:value-of select="@kategori"/><xsl:call-template name="insert-edit-link"/>
  </xsl:template -->

  <!-- xsl:template match="sekundaerkategorier">
    <b>sekundaerkategorier:</b>&#160;<xsl:apply-templates select="kategori"/><xsl:call-template name="insert-edit-link"/>
  </xsl:template -->

  <!-- xsl:template match="kategori">
    <xsl:value-of select="@kategori"/>&#160;
  </xsl:template -->

  <xsl:template match="tilbys-av">
    <b><xsl:value-of select="name()"/>:</b>&#160;hent-fra-kontaktinformasjon:&#160;<xsl:value-of select="@*"/>&#160;<xsl:call-template name="insert-edit-link"/>
  </xsl:template>

  <xsl:template match="kursavgift|undervisning-kveldstid-eller-helg|nettbasert-undervisning">
    <span style="color:#bbb"><b><xsl:value-of select="name()"/>:</b>&#160;ikke redigerbart ennå...</span>
  </xsl:template>

  <xsl:template match="kort-om-emnet|hva-laerer-du|pensum|annet|forkunnskaper">
    <h2><xsl:value-of select="name()"/></h2><xsl:call-template name="insert-edit-link"/><xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="obligatoriske-forkunnskaper">
    <h3 style="display:block"><xsl:value-of select="name()"/></h3>
    <xsl:if test="normalize-space(.)='' and @fellestekst='ingen-fellestekst'">
      <xsl:call-template name="oversett-diverse">
        <xsl:with-param name="diversetekst" select="'Ingen forutsetninger'" />
      </xsl:call-template>
    </xsl:if>
    <xsl:apply-templates/>
    <xsl:apply-templates select="@fellestekst"/>
  </xsl:template>

  <xsl:template match="anbefalte-forkunnskaper">
    <h3 style="display:block"><xsl:value-of select="name()"/></h3><xsl:apply-templates/>
  </xsl:template>

  <!-- xsl:template match="anbefalte-forkunnskaper/fritekst|formelle-forkunnskaper/fritekst"/ -->

  <!-- xsl:template match="emnekode-referanser">
    <xsl:choose>
      <xsl:when test="name(preceding-sibling::*[1])='emnekode-referanser'"></xsl:when>
      <xsl:otherwise><xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text></xsl:otherwise>
    </xsl:choose>
    <xsl:if test="not(normalize-space(.)='')">
    <li>
      <xsl:for-each select=".">
        <xsl:apply-templates mode="eller-separert"/>
      </xsl:for-each>
    </li>
    </xsl:if>
    <xsl:choose>
      <xsl:when test="name(following-sibling::*[1])='emnekode-referanser'"></xsl:when>
      <xsl:otherwise><xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text></xsl:otherwise>
    </xsl:choose>
  </xsl:template -->

  <xsl:template match="opptak-og-adgang">
    <h2><xsl:value-of select="name()"/></h2><xsl:call-template name="insert-edit-link"/>
    <xsl:apply-templates select="fritekst"/>
    <xsl:apply-templates select="@fellestekst"/>
    <xsl:apply-templates select="privatist"/>
  </xsl:template>

  <xsl:template match="overlapp">
    <h2><xsl:value-of select="name()"/></h2><xsl:call-template name="insert-edit-link"/>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="emneoverlapp">
    <p><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="emnekode-med-overlapp">
    <xsl:value-of select="studiepoeng-reduksjon"/>&#160;studiepoeng&#160;mot&#160;<xsl:apply-templates select="emnekode-referanse"/>.
  </xsl:template>

  <xsl:template match="undervisning">
    <h2><xsl:value-of select="name()"/></h2><xsl:call-template name="insert-edit-link"/>
    <xsl:apply-templates select="fritekst"/>
    <xsl:apply-templates select="tidsrom-for-undervisning"/>
    <xsl:apply-templates select="adgang"/>
  </xsl:template>

  <xsl:template match="privatist|tidsrom-for-undervisning|adgang|hjelpemidler|eksamensspraak|klage|ny-utsatt-vurdering|antall-forsok-trekk|tilrettelagt-eksamen">
    <p><b><xsl:value-of select="name()"/>:</b>&#160;<xsl:value-of select="@fellestekst"/></p>
    <xsl:apply-templates select="fritekst"/>
    <xsl:apply-templates select="@fellestekst"/>
  </xsl:template>

  <xsl:template match="karakterfastsetting|ekstern-sensor">
    <xsl:apply-templates select="fritekst"/>
    <xsl:apply-templates select="@fellestekst"/>
  </xsl:template>

  <!-- Alle fellestekstene hentes på samme måte -->
  <xsl:template match="opptak-og-adgang/@fellestekst|privatist/@fellestekst|obligatoriske-forkunnskaper/@fellestekst|tidsrom-for-undervisning/@fellestekst|adgang/@fellestekst|hjelpemidler/@fellestekst|eksamensspraak/@fellestekst|karakterfastsetting/@fellestekst|ekstern-sensor/@fellestekst|klage/@fellestekst|ny-utsatt-vurdering/@fellestekst|antall-forsok-trekk/@fellestekst|tilrettelagt-eksamen/@fellestekst|evaluering-av-emnet/@fellestekst|vurdering-og-eksamen/@fellestekst">
    <xsl:call-template name="hent-fellestekst"/>
  </xsl:template>

  <xsl:template match="vurdering-og-eksamen">
    <h2><xsl:value-of select="name()"/></h2>&#160;<xsl:call-template name="insert-edit-link"/>
    <xsl:apply-templates select="fritekst"/>
    <xsl:apply-templates select="@fellestekst"/>
    <xsl:apply-templates select="hjelpemidler"/>
    <xsl:apply-templates select="eksamensspraak"/>
    <xsl:apply-templates select="sensur"/>
    <xsl:apply-templates select="klage"/>
    <xsl:apply-templates select="ny-utsatt-vurdering"/>
    <xsl:apply-templates select="antall-forsok-trekk"/>
    <xsl:apply-templates select="tilrettelagt-eksamen"/>
  </xsl:template>

  <xsl:template match="sensur">
    <p><b><xsl:value-of select="name()"/></b></p>
    <xsl:apply-templates select="karakterfastsetting"/>
    <xsl:apply-templates select="ekstern-sensor"/>
  </xsl:template>

  <xsl:template match="evaluering-av-emnet">
    <h2 style="display:inline"><xsl:value-of select="name()"/></h2>&#160;<xsl:value-of select="@fellestekst"/><xsl:call-template name="insert-edit-link"/>
    <xsl:apply-templates select="@fellestekst"/>
    <xsl:apply-templates select="fritekst"/>
  </xsl:template>

  <xsl:template match="kontaktinformasjon">
    <h2><xsl:value-of select="name()"/></h2><xsl:call-template name="insert-edit-link"/>
    <p><xsl:apply-templates select="hent-ekstern-adresse"/></p><xsl:apply-templates select="adresse" mode="uten-redigeringslenke"/>
  </xsl:template>
    
  <xsl:template match="fritekst">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="avsnitt">
    <p><xsl:apply-templates /></p>          
  </xsl:template>

  <!-- =============================================================== -->
  <!-- Templater for redigering av elementer (mode=edit)               -->
  <!-- =============================================================== -->

  <xsl:template match="tittel" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger tittel:</b>
        </td>
      </tr>
      <tr>
        <td><label for="emnenavn">Emnenavn:</label></td>
        <td width="90%">
          <xsl:apply-templates select="emnenavn" mode="edit"/>
        </td>
      </tr>
      <tr>  
        <td valign="top"><label for="emnekode">Emnekode:</label></td>
        <td align="left">
          <xsl:apply-templates select="emnekode" mode="edit"/> 
        </td>
      </tr>
      <tr>
        <td colspan="2"><font color="blue">Husk: Kun store bokstaver og ikke noe mellomrom i emnekode!</font></td>
      </tr>
     </table>
  </xsl:template>

  <xsl:template match="emnenavn" mode="edit">
    <xsl:call-template name="insert-inputfield">
      <xsl:with-param name="size" select="35"/> 
    </xsl:call-template>
  </xsl:template>


  <xsl:template match="emnekode" mode="edit">
    <xsl:call-template name="insert-inputfield">
      <xsl:with-param name="size" select="10"/> 
    </xsl:call-template> 
  </xsl:template>

  <xsl:template match="studiepoeng" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger studiepoeng:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="insert-dropdown-integer">
            <xsl:with-param name="from" select="0"/>
            <xsl:with-param name="to" select="120"/>
            <xsl:with-param name="with-null-prefix" select="false()"/>
          </xsl:call-template>
          <!-- xsl:call-template name="insert-inputfield">
            <xsl:with-param name="size" select="2"/> 
          </xsl:call-template -->
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="undervisningssemester|eksamenssemester" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@semester" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="bestemte-semestre" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit-small"/>
        </td>
      </tr>
    </table>
    <xsl:if test="not(@semester='bestemte-semestre')"><script type="text/javascript">disableBestemteSemestre()</script></xsl:if>
  </xsl:template>

  <xsl:template match="undervisningssemester/@semester" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'vaar-og-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hver-vaar'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hver-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'over-to-semestre-oppstart-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'over-to-semestre-oppstart-vaar'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'over-to-semestre-oppstart-vaar-og-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'bestemte-semestre'"/>     
      <xsl:with-param name="onclick" select="'enableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'annet'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
      <xsl:with-param name="default" select="true()"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="eksamenssemester/@semester" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'vaar-og-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hver-vaar'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hver-hoest'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'bestemte-semestre'"/>     
      <xsl:with-param name="onclick" select="'enableBestemteSemestre()'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'annet'"/>
      <xsl:with-param name="onclick" select="'disableBestemteSemestre()'"/>
      <xsl:with-param name="default" select="true()"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="bestemte-semestre" mode="edit">
    <xsl:call-template name="insert-anchor"/>
    <div id="bestemteSemestre">
    <b><xsl:value-of select="name()"/>:</b>
    <div style="padding:10px;">
    <xsl:if test="not(./*)">
      Ingen bestemte semestre.
    </xsl:if>
    <xsl:for-each select="./*">
      <xsl:call-template name="insert-anchor"/>
      <xsl:apply-templates select="." mode="edit"/>
    </xsl:for-each>
    </div>
    <table>
      <tr>
        <td>
          <xsl:call-template name="insert-button">
            <xsl:with-param name="elementname" select="'bestemt-semester'"/>
            <xsl:with-param name="buttonname" select="'Nytt bestemt semester'"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    </div>
  </xsl:template>

  <xsl:template match="bestemt-semester" mode="edit">
    <table>
      <tr>
        <td>
          <xsl:apply-templates mode="edit"/>
        </td>
        <td>&#160;<xsl:call-template name="insert-delete-button" /></td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="fritekst" mode="edit-small">
    <xsl:call-template name="insert-textarea">
      <xsl:with-param name="rows" select="'5'" />
      <xsl:with-param name="helptext" select="'no'" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="fritekst" mode="edit-with-reference">
    <xsl:call-template name="insert-textarea">
      <xsl:with-param name="rows" select="'8'" />
      <xsl:with-param name="helptext" select="'with-reference'" />
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="undervisningsspraak" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@spraak" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="undervisningsspraak/@spraak" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'norsk'"/>
      <xsl:with-param name="default" select="true()"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'engelsk'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'engelsk-ved-behov'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'annet'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="status" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger status:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@status" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td colspan="2"><font color="blue">PS: 'tidligere-versjon' skal <b>kun</b> brukes når du flytter emnebeskrivelsen til arkiv-mappa!!</font></td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="@status" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'nedlagt-emne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'tidligere-versjon'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'gjeldende-versjon'"/>
    </xsl:call-template>
  </xsl:template>

  <!-- xsl:template match="emnekode-referanse" mode="edit-status">
    <xsl:call-template name="insert-inputfield"><xsl:with-param name="size" select="10"/></xsl:call-template>
  </xsl:template -->

  <!-- Kategorisering på tema utgår i 1. omgang -->

  <!-- xsl:template match="primaerkategori" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger primaerkategori:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@kategori" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="@kategori" mode="edit">
    <xsl:call-template name="insert-dropdown">
      <xsl:with-param name="name-value-list" select="'kultur=kultur,samfunn=samfunn,helse=helse,miljø=miljo,teknologi=teknologi,hav og fiske=hav-og-fiske,jord og skog=jord-og-skog,naturvitenskap=naturvitenskap'"/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="sekundaerkategorier" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger sekundærkategorier:</b>
        </td>
      </tr>
      <xsl:if test="not(./*)">
        <tr><td>Ingen sekundærkategorier</td></tr>
      </xsl:if>
      <xsl:for-each select="./*">
        <tr>
          <td>
            <xsl:apply-templates select="." mode="edit"/>
          </td>
        </tr>
      </xsl:for-each>
      <tr>
        <td>
          <xsl:call-template name="insert-button">
            <xsl:with-param name="elementname" select="'kategori'"/>
            <xsl:with-param name="buttonname" select="'Ny kategori'"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="kategori" mode="edit">
    <table>
      <tr>
        <td>
          <xsl:apply-templates select="@kategori" mode="edit"/>
        </td>
        <td>&#160;<xsl:call-template name="insert-delete-button" /></td>
      </tr>
    </table>
  </xsl:template -->

  <xsl:template match="emnetype" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger emnetype:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@emnetype" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="@emnetype" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'redskapsemne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'grunnemne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'videregaende-emne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'avansert-emne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'phd-emne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ikke-satt'"/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="tilbys-av" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="2">
          <b>Rediger tilbys av: </b>
        </td>
      </tr>
      <tr>
        <td>Hent&#160;fra&#160;kontaktinformasjon:</td>
        <td>
          <xsl:apply-templates select="@hent-fra-adresse" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>Lenketekst:</td>
        <td width="90%">
          <xsl:apply-templates select="weblenke/lenketekst" mode="edit" />
        </td>
      </tr>
      <tr>
        <td>Webadresse:&#160;</td>
        <td>
          <xsl:apply-templates select="weblenke/webadresse" mode="edit" />
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="@hent-fra-adresse" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ja'"/>
    </xsl:call-template>&#160;&#160;
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'nei'"/>
    </xsl:call-template>
  </xsl:template>


  <!-- Overrider for å slippe "Se dokumenter"-knappen -->
  <xsl:template match="webadresse" mode="edit">
    <xsl:call-template name="insert-inputfield" />
  </xsl:template>

  <xsl:template match="kort-om-emnet|hva-laerer-du|annet" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="insert-textarea" />
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="opptak-og-adgang" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@fellestekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="privatist" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="opptak-og-adgang/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'soknadsprosedyre-opptak'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="privatist/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ikke-privatist'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="forkunnskaper" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5" align="left">
      <tr>
        <td>
          <h2>Rediger <xsl:value-of select="name()"/>:</h2>
        </td>
      </tr>
      <xsl:apply-templates select="obligatoriske-forkunnskaper" mode="edit"/>
      <tr>
        <td>
          &#160;
        </td>
      </tr>
      <xsl:apply-templates select="anbefalte-forkunnskaper" mode="edit"/>
    </table>
  </xsl:template>

  <xsl:template match="anbefalte-forkunnskaper|obligatoriske-forkunnskaper" mode="edit">
    <tr>
      <td>
        <b><xsl:value-of select="name()"/>:</b>&#160;(husk store bokstaver i emnekoder)<xsl:call-template name="insert-anchor"/>
      </td>
    </tr>
    <tr>
      <td>
        <xsl:apply-templates select="fritekst" mode="edit-with-reference"/>
      </td>
    </tr>
    <xsl:if test="name()='obligatoriske-forkunnskaper'">
      <tr>
        <td>
          <div style="padding-top:10px;"><xsl:apply-templates select="@fellestekst" mode="edit"/></div>
        </td>
      </tr>
    </xsl:if>
  </xsl:template>

  <xsl:template match="obligatoriske-forkunnskaper/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'matnatfagkrav-generell'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'matnatfagkrav-informatikk'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'juskrav-15sp'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <!-- xsl:template match="emnekode-referanser" mode="edit">
    <xsl:call-template name="insert-anchor"/>

    <div style="padding:3px;">emnekode-referanser&#160;&#160;<xsl:call-template name="insert-delete-button" /></div>
    
    <table style="padding:5px;">
      <tr>
        <xsl:for-each select="./*">
        <td style="border:solid 1px grey;padding:10px;">
          <xsl:call-template name="insert-anchor"/>
          <xsl:apply-templates select="." mode="edit"/>&#160;<xsl:call-template name="insert-delete-button" />
        </td>
        </xsl:for-each>
        <td style="padding: 5px 0 5px 5px">
          <xsl:call-template name="insert-button">
            <xsl:with-param name="elementname" select="'emnekode-referanse'"/>
            <xsl:with-param name="buttonname" select="'Nytt emne'"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
  </xsl:template -->

  <!-- xsl:template match="emnekode-referanse" mode="edit">
    <xsl:call-template name="insert-inputfield"><xsl:with-param name="size" select="10"/></xsl:call-template>
  </xsl:template -->

  <!-- xsl:template match="anbefalte-forkunnskaper/fritekst|obligatoriske-forkunnskaper/fritekst" mode="edit">
     <table>
       <tr>
         <td>
           <xsl:call-template name="insert-textarea"> 
             <xsl:with-param name="rows" select="'4'" />
             <xsl:with-param name="cols" select="'50'" />
             <xsl:with-param name="helptext" select="'no'" />
           </xsl:call-template>
         </td>
         <td style="padding-left:5px;">
           <xsl:call-template name="insert-delete-button" />
         </td>
       </tr>
     </table>
  </xsl:template -->

  <xsl:template match="overlapp" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5" align="left">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="emneoverlapp" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="emneoverlapp" mode="edit">
    <xsl:call-template name="insert-anchor"/>
    <xsl:if test="not(./*)">
      Ingen overlappende emner.
    </xsl:if>
    <xsl:for-each select="./*">
      <xsl:call-template name="insert-anchor"/>
      <xsl:apply-templates select="." mode="edit"/>
    </xsl:for-each>
    <table>
      <tr>
        <td>
          <xsl:call-template name="insert-button">
            <xsl:with-param name="elementname" select="'emnekode-med-overlapp'"/>
            <xsl:with-param name="buttonname" select="'Ny emneoverlapp'"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="emnekode-med-overlapp" mode="edit">
    <table>
      <tr>
        <td>
          <xsl:apply-templates mode="edit"/>
        </td>
        <td>&#160;<xsl:call-template name="insert-delete-button" /></td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="studiepoeng-reduksjon" mode="edit">
    <xsl:call-template name="insert-dropdown-integer"><xsl:with-param name="from" select="1"/><xsl:with-param name="to" select="30"/><xsl:with-param name="with-null-prefix" select="false()"/></xsl:call-template>&#160;studiepoeng&#160;mot&#160;
  </xsl:template>

  <xsl:template match="emnekode-med-overlapp/emnekode-referanse" mode="edit">
    <xsl:call-template name="insert-inputfield"><xsl:with-param name="size" select="10"/></xsl:call-template>
  </xsl:template>

  <xsl:template match="undervisning" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="tidsrom-for-undervisning" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="adgang" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="privatist|tidsrom-for-undervisning|adgang|hjelpemidler|eksamensspraak|klage|ny-utsatt-vurdering|antall-forsok-trekk|tilrettelagt-eksamen" mode="edit">
    <p><b><xsl:value-of select="name()"/>:</b></p>
    <xsl:apply-templates select="fritekst" mode="edit-small"/>
    <p><xsl:apply-templates select="@fellestekst" mode="edit"/></p>
  </xsl:template>

  <xsl:template match="karakterfastsetting|ekstern-sensor" mode="edit">
    <xsl:apply-templates select="fritekst" mode="edit-small"/>
    <p><xsl:apply-templates select="@fellestekst" mode="edit"/></p>
  </xsl:template>

  <xsl:template match="tidsrom-for-undervisning/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hele-semesteret'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="adgang/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'nyundervisning-ved-kapasitet'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="vurdering-og-eksamen" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@fellestekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="hjelpemidler" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="eksamensspraak" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <b>sensur:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="sensur/karakterfastsetting" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="sensur/ekstern-sensor" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="klage" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="ny-utsatt-vurdering" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="antall-forsok-trekk" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="tilrettelagt-eksamen" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="vurdering-og-eksamen/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'hf-sitatteknikk'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
      <xsl:with-param name="default" select="true()"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="hjelpemidler/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-hjelpemidler'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="eksamensspraak/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'eksamensspraak-norsk'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="karakterfastsetting/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'bokstavskala'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'bestaatt-ikkebestaatt'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'jus-bokstavkarakter'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/><br/>
  </xsl:template>
  
  <xsl:template match="ekstern-sensor/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'tilsynssensor'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>
  
  <xsl:template match="klage/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'klage'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>
  
  <xsl:template match="ny-utsatt-vurdering/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ny-utsatt-eksamen'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>
  
  <xsl:template match="antall-forsok-trekk/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'antall-forsok-trekk'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="tilrettelagt-eksamen/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'tilrettelagt-eksamen'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>

  <xsl:template match="evaluering-av-emnet" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="@fellestekst" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="fritekst" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <xsl:template match="evaluering-av-emnet/@fellestekst" mode="edit">
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'evaluering-emne'"/>
    </xsl:call-template><br/>
    <xsl:call-template name="insert-radiobutton">
      <xsl:with-param name="value" select="'ingen-fellestekst'"/>
    </xsl:call-template><br/>
  </xsl:template>
  
  <xsl:template match="kontaktinformasjon" mode="edit">
    <table border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td>
          <b>Rediger <xsl:value-of select="name()"/>:</b>
        </td>
      </tr>
      <tr>
        <td style="padding:15px 0 15px 0;">
          <xsl:apply-templates select="hent-ekstern-adresse" mode="edit"/>
        </td>
      </tr>
      <tr>
        <td>
          <xsl:apply-templates select="adresse" mode="edit"/>
        </td>
      </tr>
    </table>
  </xsl:template>

</xsl:stylesheet>

