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

  <!-- =============================================================== -->
  <!-- quiz-edit.xsl (v001) -                                          -->
  <!-- opprettet 01.12.04 - even.halvorsen@usit.uio.no                 -->
  <!-- =============================================================== -->

  <!-- =============================================================== -->
  <!-- Dokumenttypens hovedelement blir matchet i system-edit.xsl.     -->
  <!-- =============================================================== -->
  <xsl:import href="../../../system/system-edit-v001.xsl"/>
  <xsl:import href="../../../felles/komponenter/fritekst/v002/fritekst-edit.xsl"/>
  
  <!-- =============================================================== -->
  <!-- Templates som kalles i system-edit.xsl og som kan overstyres.   -->
  <!-- Se avsnitt "Template name API" i system-edit.xsl for oversikt   -->
  <!-- over disse.                                                     -->
  <!-- =============================================================== -->

  <!-- Definer det statiske elementet rett før de flyttbare elementene -->
  <xsl:variable name="movable-or-deletable-elements-after" select="''" />

  <!-- DTD-syntaks for flyttbare og slettbare elementer (men ikke bruk mellomrom)-->
  <xsl:variable name="movable-or-deletable-elements" select="'(node)*'" />

  <!-- css-klasser kan som brukes i denne dok. typen kan legges inn her -->
  <xsl:template name="css-classes" />
 
  <xsl:template name="shortcutlinks-put-bottom" />

  <!-- =============================================================== -->
  <!-- Templater for visning og redigering legges her.                 -->
  <!-- Elementene som skal redigeres må ha: mode="edit"                -->
  <!-- =============================================================== -->

  <!-- brukes for å lage knapper -->
  <xsl:template name="choice-subelements">
      <xsl:choose>
        <xsl:when test="name()='children'">
          <xsl:value-of select="'node'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="''"/> <!-- returnerer tom verdi, brukes ikke (så vidt jeg husker) -->
        </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

  <xsl:template match="node">
    <b><xsl:value-of select="name()" />:</b>&#160;<xsl:value-of select="text()" /><xsl:call-template name="insert-edit-link" /><br />
    <xsl:apply-templates select="@*" />
    <div style="padding-left: 1em;"><xsl:apply-templates select="*" /></div>
  </xsl:template>

  <xsl:template match="children">
    <b><xsl:value-of select="name()" />:</b>&#160;<xsl:value-of select="text()" />
    <xsl:apply-templates select="@*" />
    <div style="padding-left: 1em;"><xsl:apply-templates select="*" /></div>
  </xsl:template>

  <xsl:template match="@id | @url">
    <div style="padding-left: 1em;"><xsl:value-of select="name()" />:&#160;<xsl:value-of select="." /></div>
  </xsl:template>

  <xsl:template match="description">
    <xsl:apply-templates />
  </xsl:template>
  

  <xsl:template match="node" mode="edit">
    <xsl:call-template name="sequence-edit" />
  </xsl:template>

  <xsl:template match="children" mode="edit">
    <xsl:call-template name="choice-edit" />
  </xsl:template>

 <xsl:template match="description" mode="edit">
   <xsl:call-template name="insert-textarea">
     <xsl:with-param name="rows" select="'3'" />
     <xsl:with-param name="cols" select="'40'" />
     <xsl:with-param name="helptext" select="'no'" />
   </xsl:call-template>
  </xsl:template>

  <xsl:template match="@*" mode="edit">
    <xsl:call-template name="insert-inputfield" />
  </xsl:template>
 
</xsl:stylesheet>
