<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <!-- =============================================================== -->
  <!-- course-edit.xsl (v002) -                                        -->
  <!-- opprettet 02.03.05 - oddmund.mogedal@usit.uio.no                -->
  <!-- =============================================================== -->

  <!-- =============================================================== -->
  <!-- Dokumenttypens hovedelement blir matchet i system-edit.xsl.     -->
  <!-- =============================================================== -->
  <xsl:import href="../../../system/system-edit-v001.xsl" />

  <xsl:import href="../../components/node-list-ref/v001/node-list-ref-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="'author'" />

  <!-- DTD-syntaks for flyttbare og slettbare elementer (men ikke bruk mellomrom)-->
  <xsl:variable name="movable-or-deletable-elements" select="'(page)*'" />

  <!-- 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"                -->
  <!-- =============================================================== -->

<!-- Kopiert til course.xsl -->

  <!-- brukes for å lage knapper -->
  <xsl:template name="choice-subelements">
      <xsl:choose>
        <xsl:when test="name()='children'">
          <xsl:value-of select="'page'" />
        </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="page">
    <b><xsl:value-of select="name()" />:</b> <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> <xsl:value-of select="text()" />
    <xsl:apply-templates select="@*" />
    <div style="padding-left: 1em;"><xsl:apply-templates select="*" /></div>
  </xsl:template>

<!-- Slutt kopiert -->

  <xsl:template match="page" mode="edit">
    <xsl:call-template name="sequence-edit" />
  </xsl:template>

  <xsl:template match="children" mode="edit">
    <xsl:call-template name="choice-edit" />
  </xsl:template>

<!-- Kopiert til course.xsl -->

  <xsl:template match="title|node-list-ref|author">
    <div><b><xsl:value-of select="name()" />:</b> <xsl:value-of select="." /> <xsl:call-template name="insert-edit-link" /> </div>
  </xsl:template>

<!-- Slutt kopiert -->

  <xsl:template match="title|author" mode="edit">
    <xsl:call-template name="insert-inputfield" />
  </xsl:template>

</xsl:stylesheet>
