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

  <xsl:template name="inkluder-metadata-til-profil">
    <!--Need to use the language from the XML-file untill we move
        it to a webdav-property -->
    <xsl:choose>
      <xsl:when test="$malspraak='engelsk'">
        <meta content="en" name="spraak"/>
      </xsl:when>
      <xsl:when test="$malspraak='nynorsk'">
        <meta content="no-nyn" name="spraak"/>
      </xsl:when>
      <xsl:otherwise>
        <meta content="no-bok" name="spraak"/>
      </xsl:otherwise>
    </xsl:choose>
<!--     <meta content="studier" name="tema"/> -->
<!--     <meta content="ia" name="enhet.id"/> -->

<!--     <meta content="http://www.uio.no/studier/tilbud/redaksjon.html" name="redaksjon.vev"/> -->
<!--     <meta content="Redaksjon for studietilbudet ved UiO" name="redaksjon.navn"/> -->
    <meta name="dokumenttype" content="{name(/*)}"/>
    
    <link href="http://www.uio.no/studier/tilbud/studietilbud.css" type="text/css" rel="stylesheet"/>
    <style type="text/css">
      .navmarginbrod {margin-right: 39px;} <!-- utdyper uio.css -->
      .navmarginline {margin-right: 39px;} <!-- utdyper uio.css -->
      .emner {margin-left: 10px; margin-bottom: 5px;} <!-- utdyper studietilbud.css -->
      .masteremner {margin-left: 10px; margin-bottom: 5px;} <!-- utdyper studietilbud.css -->
      h1 {font-size: 160%;font-weight: bold;}
      h2 {font-size: 130%;font-weight: bold;}
      h3 {font-size: 110%;font-weight: bold;}
      h4 {font-size: 100%;font-weight: bold;}
      .statusmessage {color:red;} <!-- brukes i emne og emnegruppe -->
      .breadcrumb-xsl {font-size:80%;}
    </style>
  </xsl:template>

  <xsl:template name="studiesti">
    <xsl:if test="$malspraak!='engelsk'">
      <div class="breadcrumb-xsl">
        <xsl:call-template name="stinavigasjon-basis"/><xsl:call-template name="dynamisk-sti"/>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template name="studiesti-alle-spraak">
    <div class="breadcrumb-xsl">
      <xsl:call-template name="stinavigasjon-basis"/><xsl:call-template name="dynamisk-sti"/>
    </div>
  </xsl:template>


  <!-- brukes i navigasjonsstien -->  
  <xsl:template name="stinavigasjon-basis"> 

  <xsl:choose>
    <xsl:when test="$malspraak='engelsk'"> <!-- malspraak er definert i translations.xsl -->
      You are here:	  
      <a href="http://www.uio.no/english/">UiO</a> >
      <a href="http://www.uio.no/english/academics/">Academics</a> >
    </xsl:when>
    <xsl:otherwise>
      Du er her:
      <a href="http://www.uio.no">UiO</a> >
      <a href="http://www.uio.no/studier/">Studier</a> > 
    </xsl:otherwise>
  </xsl:choose>
  </xsl:template>    

  <!-- Behandler 'emner' og 'program' spesielt -->
  <xsl:template name="dynamisk-sti">  
    <xsl:variable name="niva1" select="$pathElements/*[1]/@URL"/>
    <xsl:variable name="niva2" select="$pathElements/*[2]/@URL"/>
    <xsl:variable name="niva3" select="$pathElements/*[3]/@URL"/>

    <xsl:for-each select="$pathElements/*">
      <xsl:if test="not(@URL=$niva1 or @URL=$niva2)">
        <xsl:choose>
          <xsl:when test="@URL=$niva3 and @title='Emner'">
            <xsl:call-template name="oversett-diverse">
              <xsl:with-param name="diversetekst" select="'Emner'"/>
            </xsl:call-template> >
          </xsl:when>
          <xsl:when test="@URL=$niva3 and @title='Programmer'">
            <xsl:call-template name="oversett-diverse">
              <xsl:with-param name="diversetekst" select="'Programmer'"/>
            </xsl:call-template> >
          </xsl:when>
          <xsl:otherwise>
            <xsl:choose>
              <xsl:when test="normalize-space(@URL)=''">
                <xsl:value-of select="@title" />&#160;>&#32;  
              </xsl:when>
              <xsl:otherwise>
                <a href="{@URL}"><xsl:value-of select="@title" /></a>&#160;>&#32;  
              </xsl:otherwise>
            </xsl:choose>       
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>
