<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!-- ========================================== -->
  <!--  faq.xsl (v001) -                          -->
  <!-- ========================================== -->

  <xsl:import href="../../../system/api-v001.xsl" />
  <xsl:import href="../../../felles/komponenter/fritekst/v002/fritekst.xsl" />
  <xsl:import href="../../../felles/komponenter/bilde/v002/bilde.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>Raske svar: <xsl:value-of select="/faq/tittel"/></title>
        <meta name="type" content="faq" />
        <style type="text/css">
          .breadcrumb-xsl {font-size:80%;}
          
          .faqIngress { font-weight: bold; }
          
          .faqIndexTittel {
            margin-top: 0em;
            margin-bottom: 0em;
            font-size: 1.3em;
          }
          
          .faqIndexOverskrift {
            font-size: 0.9em;
            font-weight: bold;
            margin-top: 0.8em;
            margin-bottom: 0.2em;
          }
          
          p.faqIndexSporsmal:before {content: "- "}
          
          .faqIndexSporsmal { 
            font-size: 0.8em;
            margin-top: 0em;
            margin-bottom: 0.2em;
            margin-left: 0.6em;
          }
          
          .faqOverskrift {
            font-size: 1.2em;
            background-color: #cccccc;
            padding-top: 2px;
            padding-bottom: 2px;
            padding-left: 0.4em;
            margin-top: 0.4em;
          }
          
          .faqSporsmal {
            font-size: 0.9em;
            font-weight: bold;
            margin-top: 0.9em;
            margin-bottom: 0.1em;
          }
          
          .faqSvar { 
            font-size: 0.9em;
            margin-top: 0.1em;
            margin-bottom: 1.2em;
          }
          
          .faqSvar > p {
            margin-top: 0.3em;
            margin-bottom: 0em;
          }
          
          ul { margin-top: 0.1em;}
          
          .faqClear:before {
          /*content: ".";
          display: block;
          visibility: hidden;*/
          clear: both;
          }
        </style>
      </head>
      <body>
        <xsl:call-template name="prefixed-breadcrumb"/>
        
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>


  <!-- ROOT element -->
  <xsl:template match="faq">
    <xsl:call-template name="faq-top" />
    <h2 class="faqIndexTittel">Innhold:</h2>
    <xsl:call-template name="faq-index"/>
      <xsl:for-each select="*">
        <xsl:choose>
          <xsl:when test="name()='tittel'" />
          <xsl:when test="name()='faq-beskrivelse'" />
          <xsl:otherwise>
            <xsl:apply-templates select="." />          
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
  </xsl:template>


  <xsl:template match="faq-overskrift">
    <xsl:if test="not(.='')"><a name="{.}" />
      <h2 class="faqOverskrift faqClear"><xsl:value-of select="." /></h2>
    </xsl:if>
  </xsl:template>
  
    
  <xsl:template match="faq-blokk">  
    <a name="{@qid}" />
      <xsl:apply-templates />    
  </xsl:template>


  <xsl:template match="sporsmal">
    <xsl:if test="not(.='')">
      <p class="faqSporsmal faqClear"><xsl:value-of select="." /></p>
    </xsl:if>
  </xsl:template>
  
  
  <xsl:template match="svar">
    <xsl:if test="not(.='')">
      <div class="faqSvar"><xsl:apply-templates /></div>
    </xsl:if>
  </xsl:template>  
  

  <xsl:template name="faq-top"> 
    <h1> <xsl:value-of select="tittel" /> </h1>
    <p> <!-- blockquote ? -->
      <xsl:apply-templates select="faq-beskrivelse" />
    </p>  
  </xsl:template>


  <xsl:template name="faq-index"> 
      <xsl:for-each select="*">
        <xsl:if test="name()='faq-overskrift'">
          <p class="faqIndexOverskrift"><a href="#{.}"><xsl:value-of select="." /></a></p>
        </xsl:if>
        <xsl:if test="name()='faq-blokk'">
          <p class="faqIndexSporsmal"><a href="#{@qid}"><xsl:value-of select="sporsmal" /></a></p>
        </xsl:if>
      </xsl:for-each>
    <br />
  </xsl:template>

</xsl:stylesheet>
