<?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 001)                                                  -->
  <!-- ========================================================================== -->

  <!-- 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="/">
    <html>
      <head>
        <title>
          <xsl:call-template name="oversett-diverse"> 
            <xsl:with-param name="diversetekst" select="'Eksamen - tid og sted'" />
          </xsl:call-template>
          (<xsl:value-of select="/eksamen/emnekode"/> - <xsl:value-of select="/eksamen/semester" />&#160;<xsl:value-of select="/eksamen/aar"/>)
        </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:call-template name="oversett-diverse"> 
           <xsl:with-param name="diversetekst" select="'Eksamen - tid og sted'" />
         </xsl:call-template>
         (<xsl:value-of select="/eksamen/emnekode"/> - <xsl:value-of select="/eksamen/semester" />&#160;<xsl:value-of select="/eksamen/aar"/>)
       </h1>
       <xsl:choose>
         <xsl:when test="$malspraak = 'bokmaal'">
           <p>For en del emner er det ennå ikke fastsatt tid og sted for alle eksamener. Eksamensinformasjonen for disse emnene legges ut etterhvert som den blir klar.</p> 
           <p>Mer om eksamen og vurderingsformer finner du i <a href="../">emnepresentasjonen</a>. På de fleste eksamener må du møte opp 15 minutter før eksamensstart. Husk å ha med deg gyldig legitimasjon med bilde (for eksempel studentbevis fra UiO, bankkort, pass eller lignende)!</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>
           <p>For more information on the exam and evaluation for this course, check the <a href="../">course description</a>. For most exams you must report to the examination room 15 minutes before the examination is due to start. Remember to bring some form of valid identification which contains a photo (for example, a University of Oslo student card, a bank card, passport etc)!</p>
         </xsl:otherwise>
       </xsl:choose>
       <xsl:apply-templates/>
     </body>
   </html>
 </xsl:template>

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

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

 <xsl:template match="kunngjoring">
   <xsl:if test="not(dato='')">
     <h4><xsl:call-template name="oversett-element"/></h4>
     <p><xsl:apply-templates select="dato"/></p>
     <xsl:apply-templates select="avsnitt"/>
   </xsl:if>
 </xsl:template>

 <xsl:template match="oppmeldingsfrist"/>
 
 <xsl:template match="eksamensordning">
   <h3><xsl:call-template name="oversett-element"/></h3>

   <!-- Lager urler av tekst som inneholder http:// -->

   <xsl:choose>
     <xsl:when test="contains(avsnitt,'http://')">
       <xsl:call-template name="lag-url">
         <xsl:with-param name="tekst" select="avsnitt"/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <xsl:apply-templates select="avsnitt"/>
     </xsl:otherwise>
   </xsl:choose>
    
   <xsl:apply-templates select="eksamensdel"/>
 </xsl:template>

 <!-- Mulig hack for og lage lenker av alle 'http://' i kommentarfeltet i FS -->
 <xsl:template name="lag-url">
   <xsl:param name="tekst"/>
   <xsl:variable name="foo" select="normalize-space(concat('http://', substring-before(substring-after($tekst,'http://'),' ')))"/>
   
   <!-- Skriver ut det før urlen -->
   <xsl:value-of select="substring-before($tekst,'http://')"/>
   
   <!-- Bygger url-en -->
   <xsl:text disable-output-escaping="yes">&lt;a href=&quot;</xsl:text>
   <xsl:value-of select="$foo"/>
   <xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
   <xsl:value-of select="$foo"/>
   <xsl:text disable-output-escaping="yes">&lt;/a&gt;&#32;</xsl:text>
   
   <xsl:variable name="rest" select="substring-after(substring-after($tekst,'http://'),' ')"/>
   
   <xsl:choose>
     <xsl:when test="contains($rest,'http://')">
       <xsl:call-template name="lag-url">
         <xsl:with-param name="tekst" select="$rest"/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="$rest"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>

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

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

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

 <xsl:template match="dato-start">
   <xsl:value-of select="." />
 </xsl:template>

 <xsl:template match="dato-slutt">
   <!-- Finnes ikke i FS enda -->
 </xsl:template>

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

 <xsl:template match="klokkeslett-til">
   <!-- Finnes ikke i FS enda -->
 </xsl:template>

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

  <xsl:template match="eksamenssted">
    <xsl:if test="not(.='')">
      <xsl:text disable-output-escaping="yes">&lt;br&gt;</xsl:text> 
      <xsl:apply-templates/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="dato | rom">
     <xsl:value-of select="." /> 
  </xsl:template>

  <xsl:template match="bygning">
     &#160;<xsl:value-of select="." /> 
  </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: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:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
  </xsl:template>

  <xsl:template match="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>
