<?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">

  <!-- =========================================== -->
  <!--  person.xsl (v002) for HF                   -->
  <!--  04.07.05 - kristian.syversen@usit.uio.no   -->
  <!-- =========================================== -->

  <!-- prefixes (text element definitions) -->
  <xsl:import href="hf-person-translations.xsl" />

  <!-- general -->
  <xsl:import href="../../../system/api-v001.xsl" />

  <!-- =========================================== -->
  <!--  This stylesheet uses '/common/person',     -->
  <!--  while extending it by adding HF institute  -->
  <!--  HTML-profile and also features automatic   -->
  <!--  display of institute nave (based on code)  -->
  <!-- =========================================== --> 
  
  <xsl:import href="../../../uio/person/v002/person.xsl" />

  <!-- common templates -->
  <xsl:include href="../../../felles/ressurser/breadcrumb-v001.xsl" />


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

  <xsl:template match="/">

    <html>
      <head>
        <title>
          <xsl:value-of select="$firstname"/>&#160;<xsl:value-of select="$lastname"/> - <xsl:value-of select="$title"/>
        </title>        
        <link rel="stylesheet" href="http://www.hf.uio.no/css/rammeverk-stilark.css" type="text/css" />
      </head>

      <body>

        <xsl:variable name="institute-code" select="//institute/text()" />
        
        <h1> 
          <xsl:call-template name="institute">
            <xsl:with-param name="code" select="$institute-code" />
          </xsl:call-template>
          &#160; <!-- default, to ensure H1 tag gets closed -->
        </h1>
        
        <!-- wrapping contents with HF institute web profile (folders) -->
        <table class="hovedtabell-bredde" cellpadding="5" cellspacing="0">
          <tr>
            <td width="10%" class="roed-meny-celle-passiv">
              <a href="../../../">
                <xsl:call-template name="hf-person-document-phrase">
                  <xsl:with-param name="identifier" select="'hf_person.frontpage'"/>
                </xsl:call-template>
              </a>
            </td>
            <td width="2%" class="roed-mellomcelle">&#160;</td>
            <td width="15%" class="roed-meny-celle-passiv">
              <a href="../../../studier/">
                <xsl:call-template name="hf-person-document-phrase">
                  <xsl:with-param name="identifier" select="'hf_person.studies'"/>
                </xsl:call-template>
                <xsl:value-of select="$institute-code"/> 
              </a>
            </td>
            <td width="2%" class="roed-mellomcelle">&#160;</td>
            <td width="18%" class="roed-meny-celle-passiv">
              <a href="../../../forskning/">
                <xsl:call-template name="hf-person-document-phrase">
                  <xsl:with-param name="identifier" select="'hf_person.research'"/>
                </xsl:call-template>
                <xsl:value-of select="$institute-code"/> 
              </a>
            </td>
            <td width="2%" class="roed-mellomcelle">&#160;</td>
            <td width="10%" class="roed-meny-celle-aktiv">
              <a href="../../">
                <xsl:call-template name="hf-person-document-phrase">
                  <xsl:with-param name="identifier" select="'hf_person.about'"/>
                </xsl:call-template>
                <xsl:value-of select="$institute-code"/> 
              </a>
            </td>
            <td width="2%" class="roed-mellomcelle">&#160;</td>
            <td width="13%" class="roed-meny-celle-passiv">
              <a href="../../../for-ansatte/">
                <xsl:call-template name="hf-person-document-phrase">
                  <xsl:with-param name="identifier" select="'hf_person.for_employees'"/>
                </xsl:call-template>
              </a>
            </td>
            <td class="roed-english-celle"><!-- In English -->&#160;</td>
          </tr>
          <tr valign="top" class="roed-kropp">
            <td colspan="10" class="roed-kropp">  
        
              <!-- content wrapper (for proper padding) -->
              <div style="padding: 15px;">
              
                <small> <xsl:call-template name="prefixed-breadcrumb" /> </small>
                
                <!-- matching PERSON which is transformed by general 'person.xsl' -->
                <xsl:apply-templates />

              </div>             
            </td>
          </tr>
        </table>

      </body>
    </html>
  </xsl:template>
  
  
  <!-- overriding template to display correct institute name -->
  <xsl:template name="institute">
    <xsl:param name="code" />
       
    <xsl:choose>
      <xsl:when test="$code='IAKH'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.IAKH'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='IKOS'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.IKOS'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='IFIKK'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.IFIKK'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='ILOS'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.ILOS'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='ILN'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.ILN'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='IMK'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.IMK'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$code='IMV'">
        <xsl:call-template name="hf-person-document-phrase">
          <xsl:with-param name="identifier" select="'hf_person.IMV'"/>
        </xsl:call-template>
      </xsl:when>
      <!-- tom kode -->
      <xsl:when test="$code='' or string-length($code)=0">
        <i>
          <xsl:call-template name="hf-person-document-phrase">
            <xsl:with-param name="identifier" select="'hf_person.institute_code_missing'"/>
          </xsl:call-template>
        </i>
      </xsl:when>
      <!-- default -->
      <xsl:otherwise>
        <xsl:value-of select="//institute" />
      </xsl:otherwise>
    </xsl:choose>
    
  </xsl:template>

</xsl:stylesheet>
