<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <!-- ========================================== -->
  <!--  disputas.xsl (v001)                       -->
  <!--  19.10.06 - kristian.syversen@usit.uio.no  -->
  <!-- ========================================== -->
  
  <xsl:import href="../../../felles/komponenter/fritekst/v002/fritekst.xsl" />
  <xsl:import href="../../../felles/komponenter/tid-og-sted/v001/tid-og-sted.xsl" />
  
  <xsl:import href="../../../system/api-v001.xsl" />
  <xsl:import href="../../../felles/ressurser/url-tools-v001.xsl" />
  <xsl:include href="../../../felles/ressurser/breadcrumb-v001.xsl" />
  <xsl:include href="../../../felles/ressurser/output-method-html-v001.xsl" />


  <xsl:strip-space elements="*"/>

  <xsl:template match="/">
    <html>
      <head>
        <title>
          Disputas:&#160;<xsl:apply-templates select="//doktorand" />&#160;-&#160;<xsl:value-of select="disputas/oppgavetittel"/>
        </title>
        <style type="text/css">
          .breadcrumb-xsl {font-size:80%;}

	  abbr {
	    text-decoration: none;
	    border-bottom: 0 !important;
	  }

        </style>
      </head>
      <body class="vevent">
        <xsl:call-template name="prefixed-breadcrumb"/>
        <xsl:apply-templates select="disputas" />
      </body>
    </html>
  </xsl:template>
  
  
  <xsl:template match="disputas">
    <h1 class="summary">
      Disputas: <xsl:apply-templates select="doktorand" />
    </h1>
    <p>ved <xsl:value-of select="tilhorighet"/> vil forsvare sin avhandling for graden <xsl:value-of select="grad"/></p> 
    <p><b><i>"<xsl:value-of select="oppgavetittel" />"</i></b></p>
    <h2>Tid og sted</h2>
    <p>
      <xsl:apply-templates select="tid-og-sted">
        <xsl:with-param name="property-prefix" select="'disputas'" />
        <xsl:with-param name="property-starttime" select="'tid-og-sted.start'" />
        <xsl:with-param name="property-endtime" select="'tid-og-sted.slutt'" />
      </xsl:apply-templates>
    </p>
    <xsl:apply-templates select="proveforelesninger | komite | leder-av-disputas | veileder | sammendrag | kontaktperson"/>
  </xsl:template>
  
  
  <!-- disse elementene er allerede håndtert -->
  <xsl:template match="grad | tilhorighet | oppgavetittel" />
  
  
  <xsl:template match="doktorand">
    <xsl:if test="tittel!=''"><xsl:value-of select="tittel"/><xsl:text> </xsl:text></xsl:if><xsl:value-of select="fornavn"/><xsl:text> </xsl:text><xsl:value-of select="etternavn"/> 
  </xsl:template>  
  
  
  <xsl:template match="proveforelesninger">
    <xsl:if test="not(normalize-space(.)='')">
      <xsl:choose>
        <xsl:when test="referanser/referanse[2]">
          <h2>Prøveforelesninger</h2>
        </xsl:when>
        <xsl:otherwise>
          <h2>Prøveforelesning</h2>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates />
    </xsl:if>
  </xsl:template>
  
  
  <xsl:template match="referanse">
    <xsl:if test=".!=''">
      <p>
        <xsl:variable name="url">
          <xsl:call-template name="make-me-a-url-xml">
            <xsl:with-param name="ref" select="." />
          </xsl:call-template>
        </xsl:variable>
        <xsl:variable name="doc" select="document($url, self::node())" />        
        <xsl:choose>
          <xsl:when test="not($url='false') and $doc/node()">
            <xsl:variable name="root" select="$doc/proveforelesning" />
            <xsl:choose>
              <xsl:when test="$root/node()">
                <a href="{$url}"><xsl:apply-templates select="$root/tid-og-sted/start"/> - <xsl:value-of select="$root/emne"/></a>
              </xsl:when>
              <xsl:otherwise>
                <a href="{$url}"> <xsl:value-of select="."/> </a>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <a href="{$url}"> <xsl:value-of select="."/> </a>
          </xsl:otherwise>
        </xsl:choose>
      </p>
    </xsl:if>
  </xsl:template>
  
  
  <xsl:template match="kommentar">
    <xsl:apply-templates />
  </xsl:template>
  
  
  <xsl:template match="komite">
    <xsl:if test="not(normalize-space(.)='')">
      <h2>Bedømmelseskomit&#233;</h2> <!-- &#233 = é -->
      <xsl:apply-templates />
    </xsl:if> 
  </xsl:template>
  
  <xsl:template match="medlemmer">
    <p><xsl:apply-templates/></p>
  </xsl:template>
  
  <xsl:template match="medlem">
    <xsl:value-of select="." /><br />
  </xsl:template>
  
  
  <xsl:template match="leder-av-disputas">
    <xsl:if test="not(normalize-space(.)='')">
      <p>
        <b>Leder av disputas:</b>&#160;
        <xsl:value-of select="." />
      </p>
    </xsl:if> 
  </xsl:template>
  
  
  <xsl:template match="veileder">
    <xsl:if test="not(normalize-space(.)='')">
      <p>
        <b>Veileder:</b>&#160;
        <xsl:value-of select="." />
      </p>
    </xsl:if> 
  </xsl:template>
  
  
  <xsl:template match="sammendrag">
    <xsl:if test="not(normalize-space(.)='')">
      <h2>Sammendrag</h2>
      <xsl:apply-templates />
    </xsl:if> 
  </xsl:template>
  
  
  <xsl:template match="kontaktperson">
    <xsl:if test="not(normalize-space(.)='')">
      <h2>Kontaktperson</h2>
      <p>For mer informasjon, kontakt <a href="{concat('http://www.uio.no/sok?person=', brukernavn)}"><xsl:value-of select="navn"/></a>.</p>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>
