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

  <!-- felles komponenter -->
  <xsl:import href="../../../felles/komponenter/fritekst/v002/fritekst.xsl" />
  <xsl:import href="../../../felles/komponenter/bilde/v002/bilde.xsl" />
  <xsl:import href="../../../felles/komponenter/overskrift/v002/overskrift.xsl" />
  <xsl:import href="../../../felles/komponenter/tabell/v001/tabell.xsl" />
  <!-- xsl:import href="../../../felles/komponenter/tid-og-sted/v001/tid-og-sted.xsl" / -->
  <!-- bruker property isteden -->

  <xsl:import href="../../../system/api-v001.xsl" />
  <xsl:include href="../../../felles/ressurser/output-method-html-v001.xsl" />
  <xsl:include href="../../../felles/ressurser/breadcrumb-v001.xsl" />
  <xsl:include href="../../../extensions/property-accessor-v001.xsl"/> 

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

  <xsl:template match="/">
    <html>
      <head>
        <title><xsl:value-of select="nyhet/tittel"/></title> 
        <style type="text/css">
          .breadcrumb-xsl {font-size:80%;}
          .ingress {font-weight: bold;}
          .ingress img {float:right; margin: 0 0 .5em .5em;}
        </style>
      </head>
      <body>
        <xsl:call-template name="prefixed-breadcrumb"/>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="nyhet">
    <xsl:apply-templates select="tittel | dato" />
    <xsl:apply-templates select="*[not(name()='tittel')][not(name()='dato')]" />
  </xsl:template>


  <xsl:template match="tittel">
    <h1><xsl:value-of select="."/></h1>
  </xsl:template>

  <xsl:template match="ingress">
    <p class="ingress">
      <xsl:if test="normalize-space(../ingressbilde)!=''"><img src="{../ingressbilde}" alt="ingressbilde" /></xsl:if>
      <xsl:value-of select="." />
    </p>
  </xsl:template>

  <xsl:template match="media">
    <xsl:if test="normalize-space(.)!=''">
      <!-- object style="float:left;" width="300" height="42">
	<param name="src" value="{.}"/>
	<param name="autoplay" value="false" />
	<param name="controller" value="true" />
	<param name="bgcolor" value="#FFF" />
	<embed src="{.}" autostart="false"
	       width="300" height="42"
	       controller="true"
	       bgcolor="#ffffff">
	</embed>
      </object> 
      <div style="margin-top: 0.7em; margin-left: 0.5em; float:left;">
	(<a href="{.}">last ned fil</a>)
      </div -->
      <p><b>Media:</b>&#160;<a href="{.}"><xsl:value-of select="."/></a></p>
    </xsl:if>
  </xsl:template>

  <xsl:template match="ingressbilde" /> <!-- skrives ut i ingress -->

  <xsl:template match="dato">
    <xsl:variable name="datoen">
      <xsl:call-template name="property-value">
        <xsl:with-param name="prefix" select="'nyhet'" />
        <xsl:with-param name="name" select="'dato'" />
      </xsl:call-template>
    </xsl:variable>
    <p class="dato">
      <xsl:value-of select="$datoen" />
<!--      <xsl:value-of select="dag" />.<xsl:value-of select="maaned" />.<xsl:value-of select="aar" />&#160;
      <xsl:call-template name="nyhet-phrase">
        <xsl:with-param name="identifier" select="'nyhet.klokken'"/>
      </xsl:call-template>&#160;<xsl:value-of select="time" />:<xsl:value-of select="minutt" />
-->    </p>
  </xsl:template>
  
  
  <!-- ================================================== -->
  <!--  prefix-translation                                -->
  <!-- ================================================== -->
  
  <!-- Valid values: normalize-space($contentLanguage)='no' / 'en' / 'no_NO_NY' -->
  
  <!-- To use:
    <xsl:call-template name="time-and-place-phrase">
    <xsl:with-param name="identifier" select="'time-and-place.identifierName'"/>
    </xsl:call-template>
  -->  
  
  <!-- xsl:template name="nyhet-phrase">  
    <xsl:param name="identifier"/>
    <xsl:param name="string" select="''"/>
    
    <xsl:choose>    
      
      <xsl:when test="$identifier='nyhet.klokken'">
        <xsl:choose>
          <xsl:when test="normalize-space($contentLanguage)='en'">at</xsl:when>
          <xsl:otherwise>kl.</xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      
    </xsl:choose>
  </xsl:template -->
  
</xsl:stylesheet>
