<?xml version="1.0"?>
<!--
$Id: default.xsl,v 1.16 2004/07/06 06:35:54 jmates Exp $

The author disclaims all copyrights and releases this document into
the public domain.

Stylesheet for transformation of the XML output of the cvs2cl.pl
utility.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" xmlns:cvs2cl="http://www.red-bean.com/xmlns/cvs2cl/">

  <xsl:import href="../shared.xsl"/>

  <xsl:param name="default.subdir"/>
  <xsl:param name="default.uri"/>

  <xsl:output method="xml" media-type="text/html" indent="no"/>
  <xsl:strip-space elements="*"/>

  <xsl:param name="request.preferred_style">
    <xsl:text>default</xsl:text>
  </xsl:param>

  <xsl:param name="stylesheet.version">
    <xsl:text>$Id: default.xsl,v 1.16 2004/07/06 06:35:54 jmates Exp $</xsl:text>
  </xsl:param>

  <xsl:template match="cvs2cl:changelog">
    <html lang="en-US">
      <head>
        <title>CVS ChangeLog</title>

<!-- figure out CSS stylesheet to use by param name passed in -->
<!-- reuse eolas CSS to reduce work we have to do here -->
        <xsl:element name="link">
          <xsl:attribute name="rel">stylesheet</xsl:attribute>
          <xsl:attribute name="type">text/css</xsl:attribute>
          <xsl:attribute name="href">
            <xsl:text>/_xs/eolas/</xsl:text>
            <xsl:choose>
              <xsl:when test="string-length($request.preferred_style) &gt; 0">
                <xsl:value-of select="$request.preferred_style"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text>default</xsl:text>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:text>.css</xsl:text>
          </xsl:attribute>
        </xsl:element>

<!--        <link rel="P3Pv1" href="/w3c/p3p.xml"/> -->
        <meta name="MSSmartTagsPreventParsing" content="TRUE"/>
      </head>
      <body>
        <xsl:call-template name="navlinks"/>
        <xsl:call-template name="page-header"/>
        <xsl:apply-templates select="cvs2cl:entry"/>
        <xsl:call-template name="page-footer"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="page-header">
    <h1>CVS ChangeLog</h1>
  </xsl:template>

<!-- page closing remarks -->
  <xsl:template name="page-footer">
    <div class="footer">
      <xsl:text>Format: </xsl:text>
      <xsl:call-template name="style-choice">
        <xsl:with-param name="style-file">xml</xsl:with-param>
        <xsl:with-param name="style-title">Original XML</xsl:with-param>
      </xsl:call-template>

      <br/>
      <br/>
      <xsl:value-of select="$stylesheet.version"/>
    </div>
  </xsl:template>

  <xsl:template name="style-choice">
    <xsl:param name="style-file"/>
    <xsl:param name="style-title"/>

    <xsl:element name="a">
      <xsl:attribute name="href">
        <xsl:value-of select="$default.uri"/>
        <xsl:text>?style=</xsl:text>
        <xsl:value-of select="$style-file"/>
      </xsl:attribute>
      <xsl:value-of select="$style-title"/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="cvs2cl:entry">
    <p class="info">
      <span class="date">
        <xsl:value-of select="cvs2cl:date"/><xsl:text> </xsl:text>
        <xsl:value-of select="cvs2cl:time"/><xsl:text> &#xA0; </xsl:text>
      </span>
      <xsl:value-of select="cvs2cl:author"/>
    </p>
    <blockquote>
      <xsl:text>* </xsl:text>
      <xsl:for-each select="cvs2cl:file">
        <span class="file">
          <xsl:value-of select="cvs2cl:name"/>
        </span>
        <xsl:if test="cvs2cl:revision">
          <xsl:text> (</xsl:text>
          <xsl:value-of select="cvs2cl:revision"/>
          <xsl:text>)</xsl:text>
        </xsl:if>
        <xsl:if test="not(position()=last())">
          <xsl:text>, </xsl:text>
        </xsl:if>
      </xsl:for-each>
      <xsl:text>: </xsl:text>
      <xsl:value-of select="cvs2cl:msg"/>
    </blockquote>
  </xsl:template>
</xsl:stylesheet>
