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

  <!-- =============================================================== -->
  <!-- tabell.xsl (v001) -                                             -->
  <!-- opprettet 20.07.04 - Benedikte Lund (i.b.s.lund@usit.uio.no)    -->
  <!-- =============================================================== -->

  <xsl:import href="../../../felles/komponenter/fritekst/v002/fritekst.xsl" />
  <xsl:import href="../../../felles/komponenter/tabell/v001/tabell.xsl" />
  <xsl:import href="../../../system/api-v001.xsl"/>

  <xsl:include href="../../../felles/ressurser/output-method-html-v001.xsl" />

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

  <xsl:variable name="filename">
    <xsl:value-of select="substring-after(substring-after($CURRENT-URL,substring-after($PARENT-COLLECTION,'/')),'/')"/>
  </xsl:variable>

  <xsl:template match="/">
    <html>
      <head>
        <title>
          Viser tabell fra dokument: <xsl:value-of select="$filename"/>
        </title>    
      </head>
      
      <body>
        <h1><xsl:value-of select="$filename"/></h1>
        <xsl:apply-templates select="tabell" />
      </body>
    </html>
  </xsl:template>
  
  <!-- template for tabell ligger i ../../../felles/komponenter/tabell/v001/tabell.xsl -->
     
  <!-- alternativ visning -->
  <!-- xsl:template match="rad">
    <xsl:variable name="antall">
      <xsl:value-of select="count(celle)" />
    </xsl:variable>
    
    <xsl:variable name="colspan">
      <xsl:value-of select="floor(100 div $antall)" />
    </xsl:variable>
    
    
    <tr>
      <xsl:for-each select="celle">
        <xsl:choose>
          <xsl:when test="not(position()=last())">
            
            <td colspan="{$colspan}" width="{$colspan}%">
              <xsl:apply-templates />
            </td>
          </xsl:when>
          <xsl:otherwise>
            
            <xsl:variable name="col">
              <xsl:value-of select="100 mod $antall + $colspan"/>
            </xsl:variable>
            
            <td colspan="{$col}" width="{$col}%">
              <xsl:apply-templates />
            </td>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
      
    </tr>
  </xsl:template -->
  
  
</xsl:stylesheet>



