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

  <!-- =============================================================== -->
  <!-- hotspots-node.xsl (v001)                                        -->
  <!-- opprettet 29.04.05 - oddmund.mogedal@usit.uio.no                -->
  <!-- =============================================================== -->

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

  <xsl:import href="../../../common/components/structuredtext/v002/structuredtext.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><xsl:value-of select="$CURRENT-URL" /></title>
        <style TYPE="text/css"> 
          .mindremargintopp {margin-top: -5px;}  
          .breadcrumb-xsl {font-size:80%;}  
        </style>
      </head>
      <body>
        <xsl:call-template name="prefixed-breadcrumb"/>
        <xsl:apply-templates /> 
        <div style="text-align:right;"><a href="{$ADMIN-URL}">Administrer dette dokumentet</a></div>
      </body>
    </html> 
  </xsl:template>

  <xsl:template match="hotspots-node">

    <!-- Bruker variabler her også for å beholde det mest mulig likt image -->

    <xsl:variable name="url">
      <xsl:value-of select="url" />
    </xsl:variable>
 
    <!-- alt-text må ha verdi -->
    <xsl:variable name="alt-text">
      <xsl:choose>
        <xsl:when test="normalize-space(alt-text)=''">
          <xsl:value-of select="'image'" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="alt-text" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="caption">
      <xsl:value-of select="caption" />
    </xsl:variable>
   
    <xsl:variable name="height">
      <xsl:value-of select="@height" />
    </xsl:variable>

    <xsl:variable name="width">
      <xsl:value-of select="@width" />
    </xsl:variable>
 
    <!-- må bruke tabell for at bildeteksten ikke skal skli ut. -->
    <!-- Evt. må høyde og bredde settes på bilde -->
    <table style="" cellspacing="0" cellpadding="0" align="left" width="5%">
      <xsl:attribute name="style">
        <xsl:value-of select="'border: 1px solid #666; padding:0; margin:0 0.75em 0 0'" />
      </xsl:attribute>
      <tr>
        <td>
          <img style="margin:0; padding:0;" src="{$url}" alt="{$alt-text}">
            <xsl:if test="$height and not($height='')">
              <xsl:attribute name="height">
                <xsl:value-of select="$height" />
              </xsl:attribute>
            </xsl:if>
            <xsl:if test="$width and not($width='')">
              <xsl:attribute name="width">
                <xsl:value-of select="$width" />
              </xsl:attribute>
            </xsl:if>
          </img>
        </td>
      </tr>
      <tr>
        <td><xsl:apply-templates select="caption" /></td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot X1:</div>
          <xsl:apply-templates select="@x1"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot Y1:</div>
          <xsl:apply-templates select="@y1"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot X2:</div>
          <xsl:apply-templates select="@x2"/>
        </td>
      </tr>
      <tr>  
        <td>
          <div style="padding-bottom:5px;padding-top:5px;" class="light">Hotspot Y2:</div>
          <xsl:apply-templates select="@y2"/>
        </td>
      </tr>
    </table>      
  </xsl:template>

  <xsl:template match="alt-text|url" />

  <!-- TODO: Vise som bilde, så med innrykk for hotspots... -->
  <xsl:template match="image-url">
    <div><b><xsl:value-of select="name()" />:</b> <xsl:value-of select="." /></div>
  </xsl:template>

  <xsl:template match="@x1|@y1|@x2|@y2">
    <div><b><xsl:value-of select="name()" />:</b> <xsl:value-of select="." /></div>
  </xsl:template>

  <xsl:template match="caption">
    <div style="clear:both; font-size:76%; text-align:left; padding:0.5em;">
      <xsl:apply-templates />
    </div>
  </xsl:template>


</xsl:stylesheet>
