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

  <!-- ========================================================================== -->
  <!-- eksamen.xsl (versjon 002)                                                  -->
  <!-- ========================================================================== -->

  <!-- Felles for studiedokumenter -->
  <xsl:include href="../../ressurser/profil-v001.xsl"/>
  <xsl:include href="../../ressurser/translations-v001.xsl"/>
  <xsl:include href="../../ressurser/mapping-v001.xsl"/>

  <!-- Felles for alle dokumenter -->
  <xsl:include href="../../../system/api-v001.xsl"/>
  <xsl:include href="../../../felles/ressurser/output-method-html-v001.xsl"/>

  <xsl:template match="/">
    <xsl:variable name="tittel">
      <xsl:call-template name="oversett-diverse"> 
	<xsl:with-param name="diversetekst"
	                select="'Tid og sted for eksamen/vurdering'"/>
      </xsl:call-template>
      (<xsl:value-of select="/eksamen/emnekode"/> -
      <xsl:value-of select="concat(/eksamen/semester,'&#160;',/eksamen/aar)"/>)
    </xsl:variable>
    <html>
      <head>
        <title><xsl:value-of select="$tittel"/></title>
        <!-- Henter metadata fra profil-v001.xsl -->
        <xsl:call-template name="inkluder-metadata-til-profil"/>
      </head>

      <body>
        <xsl:call-template name="studiesti"/>
        <h1 id="tekststart"><xsl:value-of select="$tittel"/></h1>
        <xsl:choose>
          <xsl:when test="$malspraak = 'bokmaal'">
            <p>For noen emner er det ennå ikke fastsatt tid og sted for
            alle eksamener/vurderinger. Informasjonen om tid og sted for
            disse eksamenene/vurderingene offentliggjøres etter hvert som
            den blir klar.</p>
          </xsl:when>
          <xsl:when test="$malspraak = 'nynorsk'">
            <p>For nokre emne er ikkje tid og stad bestemt for alle
            eksamenar/vurderingar enno. Informasjon om tid og stad for
            desse eksamenane/vurderingane vert gjort kjend etter kvart som
            den vert klar.</p>
          </xsl:when>
          <xsl:otherwise>
            <p>For some courses, the time and place for exams has not yet
            been decided. Information about these exams will be published
            as soon as it is available.</p>
          </xsl:otherwise>
        </xsl:choose>
 
        <xsl:apply-templates/>

        <xsl:call-template name="oversett-diverse">
          <xsl:with-param name="diversetekst" select="'sted-oppmote'"/>
        </xsl:call-template>
        <xsl:call-template name="kunngjoring"/>
        <xsl:choose>
          <xsl:when test="$malspraak = 'bokmaal'">
            <a href="../">Mer om eksamen og vurderingsformer for dette emnet
            finner du i emnebeskrivelsen</a>.
          </xsl:when>
          <xsl:when test="$malspraak = 'nynorsk'">
            <a href="../">Meir om eksamen og vurderingsformer på dette emnet
            finn du i emnebeskrivelsen</a>.
          </xsl:when>
          <xsl:otherwise>
            <a href="../">For more information on the examinations and 
            assessment relating to this course, check the course description</a>.
          </xsl:otherwise>
        </xsl:choose>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="emnekode|semester|aar"/> <!-- skrives ut i tittel -->

  <xsl:template match="kommentar">
    <h2><xsl:call-template name="oversett-element"/></h2>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="trekkfrist">
    <h4><xsl:call-template name="oversett-element"/></h4>
    <p><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="kunngjoring"/>

  <xsl:template name="kunngjoring">
    <h2>
      <xsl:call-template name="oversett-diverse">
	<xsl:with-param name="diversetekst" select="'kunngjoringstittel'"/>
      </xsl:call-template>
    </h2>
    <xsl:if test="/eksamen/kunngjoring/dato">
      <p><xsl:apply-templates select="/eksamen/kunngjoring/dato"/></p>
    </xsl:if>
    <xsl:call-template name="oversett-diverse">
      <xsl:with-param name="diversetekst" select="'kunngjoring'"/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="oppmeldingsfrist"/>

  <xsl:template match="individuell-plassering">
    <h2><xsl:call-template name="oversett-element"/></h2>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="eksamensordning">
    <h2>
      <xsl:call-template name="oversett-element"/>
    </h2>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="eksamensordningsnavn">
    <p><xsl:value-of select="."/></p>
  </xsl:template>

  <xsl:template match="eksamensdel">  
    <xsl:apply-templates select="eksamensdelnavn"/>
    <xsl:apply-templates select="dato-start"/>
    <xsl:apply-templates select="klokkeslett-fra"/>
    <xsl:apply-templates select="dato-slutt"/>
    <xsl:apply-templates select="klokkeslett-til"/>
    <xsl:apply-templates select="varighet"/>
    <xsl:if test="eksamenssted/*">
      <ul>
        <xsl:apply-templates select="eksamenssted"/>
      </ul>
    </xsl:if>
    <xsl:apply-templates select="avsnitt"/>
  </xsl:template>

  <xsl:template match="eksamensdelnavn">
    <h3><xsl:value-of select="." /></h3>
  </xsl:template>

  <xsl:template match="eksamensform">
    <!-- Tom inntil FS rydder opp -->
  </xsl:template>

  <!-- Desse tre må språktilpassast -->
  <xsl:template match="dato-slutt">
    <xsl:if test="../dato-start">
      til&#160;
    </xsl:if>
    <xsl:value-of select="." />
  </xsl:template>

  <xsl:template match="klokkeslett-fra">
    kl. <xsl:value-of select="." />
  </xsl:template>

  <xsl:template match="klokkeslett-til">
    <xsl:if test="../dato-slutt">
      kl. <xsl:value-of select="." /> 
    </xsl:if>
  </xsl:template>

  <xsl:template match="varighet">
    <xsl:value-of select="concat('&#160;(',.,'&#160;')"/>
    <xsl:call-template name="oversett-diverse">
      <xsl:with-param name="diversetekst" select="'timer'"/>
    </xsl:call-template>).
  </xsl:template>

  <xsl:template match="eksamenssted">
    <li>
      <xsl:apply-templates/>
    </li>
  </xsl:template>

  <xsl:template match="rom">
     <xsl:value-of select="." />&#160;
  </xsl:template>


  <!-- grunnelementer som overstyrer common-view.xsl -->
  <xsl:template match="avsnitt">
    <p><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="fet">
    <b><xsl:value-of select="."/></b>
  </xsl:template>

  <xsl:template match="kursiv">
    <i><xsl:value-of select="."/></i>
  </xsl:template>

  <xsl:template match="avsnitt/liste">
    <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
    <xsl:call-template name="liste"/>
    <xsl:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
  </xsl:template>

  <xsl:template match="liste" name="liste">
    <xsl:choose>
      <xsl:when test="@type='nummerert'">
	<ol><xsl:apply-templates/></ol>
      </xsl:when>
      <xsl:otherwise>
	<ul><xsl:apply-templates/></ul>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="listepunkt">
    <li><xsl:apply-templates/></li>
  </xsl:template>

  <xsl:template match="weblenke">
    <a href="{webadresse}"><xsl:value-of select="lenketekst"/></a>
  </xsl:template>

</xsl:stylesheet>
