<?xml version='1.0'?>
<xsl:stylesheet 
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--*
    * $Id: lcissues.xsl,v 2.3 2001/03/14 22:42:10 cmsmcq Exp $
    *-->
<!--* Revisions:
    * 2000-05-17 : CMSMcQ : make version for XT
    * 2000-05-10 : CMSMcQ : make lcissues.msxsl, for last-call issues
    * 1999-10 : CMSMcQ : make different orders of display, and
    * try to enable dynamic switching among them.  (No luck yet.)
    * 1999-08 : CMSMcQ : make issues display in different colors 
    * depending on their status
    * 1999-06?
    * Cut down from xmlschema by Henry S. Thompson for use with
    * issues.xml,
    * based on http://www.w3.org/1999/05/06-xmlschema-1/XMLspec-19990503.xsl
    * and an original from Jonathan Marsh
    *-->

<!--* 
  // This stylesheet is designed to generate static HTML, no sorting.
  // At some point, I'll see if I can figure out how to use the
  // xt command line to customize the file.

  // We set up a global variable named kwStyle to indicate the
  // style desired.  Possible styles are: number status locus cluster
  // 2000-01-24: Also a variable named kwFull to indicate whether 
  // the display should be full or brief.  Brief = no editorial issues,
  // and open issues only.
  // 2000-05-10: to make this whole thing free-standing, we 
  // manage global variables as a pseudo-attribute on the root
  // element of the document.
  // Globals:  
  //  kwSort = number | class | cluster | status | locus | title
  //  kwFull = brief | full
  //  kwOutputform = xmp | html

  // In the output, we provide a function to set the style variable:
  // setStyle()
*-->

<xsl:output method="html" 
            indent="no"
            doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>
<xsl:strip-space 
 elements="issues
           header
           issue
           description
           references
           input
           interaction
           proposal
           resolution
           ulist
           olist"/>
<xsl:preserve-space elements="xsl:text"/>

<!--* <xsl:template><xsl:value-of select="."/></xsl:template> *-->

<xsl:template match='*'>
  <xsl:element name="SPAN">
    <xsl:attribute name="STYLE">color:red</xsl:attribute>
    <xsl:attribute name='TITLE'><xsl:value-of select="name()"/></xsl:attribute>
    <xsl:text>&lt;</xsl:text>
    <xsl:value-of select="name()"/>
    <xsl:text>&gt;</xsl:text>
    <xsl:apply-templates/>
    <xsl:text>&lt;/</xsl:text>
    <xsl:value-of select="name()"/>
    <xsl:text>&gt;</xsl:text>
  </xsl:element>
</xsl:template>

<xsl:template match='processing-instruction()'/>
<xsl:template match='comment()'/>

<xsl:template match='/'>

<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">-->
<html id='htmlroot'>
 <xsl:text>&#xA;</xsl:text>
 <xsl:comment>
  <xsl:text>Need to find a way to insert the current date</xsl:text>
 </xsl:comment>
 <xsl:text>&#xA;</xsl:text>
 <head>
  <xsl:text>&#xA;</xsl:text>
  <title><xsl:value-of select="issues/title"/></title>
  <xsl:text>&#xA;</xsl:text>
  <style type='text/css'>
    <xsl:text>
         BODY {  margin: 2em 1em 2em 70px;  
                 font-family: New Times Roman, serif;    
                 color: black;    
                 background-color: white;}
         P {     margin-top: 0.6em;      
                 margin-bottom: 0.6em;}
         PRE {   font-family: monospace 
                 margin-left: 2em }  
         DIV.ISSUE { 
                 margin-top: 4em;
                 }  
         A:hover { background: #CCF }    &#xA;</xsl:text>
  </style>
  <xsl:text>&#xA;</xsl:text>
 </head>
 <xsl:text>&#xA;&#xA;</xsl:text>
 <body>
  <xsl:text>&#xA;</xsl:text>
  <div id="htmlbody">
   <xsl:apply-templates/>
  </div>
  <xsl:text>&#xA;&#xA;</xsl:text>
 </body>
 <xsl:text>&#xA;</xsl:text>
</html>

</xsl:template>

<xsl:template match="issues">
  <xsl:apply-templates select="header|title" mode="frontmatter"/>
  <table>
   <xsl:text>&#xA;</xsl:text>
   <tr>
     <th style="text-align:left; width:6%">Num</th>
     <th style="text-align:left">Cl</th>
     <th style="text-align:left">Cluster</th>
     <th style="text-align:left">Status</th>
     <!--*
     <th style="text-align:left">Locus</th>
     *-->
     <th style="text-align:left">Originator</th>
     <th style="text-align:left">Responsible</th>
     <th style="text-align:left">Description</th>
   </tr>
   <xsl:apply-templates select="issue" mode="toc">
   </xsl:apply-templates>
   <xsl:text>&#xA;</xsl:text>
  </table>
  <xsl:text>&#xA;</xsl:text>
  <hr/>
  <xsl:text>&#xA;&#xA;</xsl:text>
  <xsl:apply-templates select="issue"/>
</xsl:template>

<xsl:template match="issues/title" mode="frontmatter">
  <xsl:text>&#xA;</xsl:text>
  <h1><xsl:apply-templates/></h1>
  <xsl:text>&#xA;</xsl:text>
  <h3>Version <xsl:value-of select='/issues/@version'/></h3> 
  <xsl:text>&#xA;</xsl:text>
</xsl:template>
<xsl:template match="issues/header" mode="frontmatter">
  <xsl:text>&#xA;&#xA;</xsl:text>
  <hr/>
  <xsl:text>&#xA;</xsl:text>
  <xsl:apply-templates/>
  <xsl:text>&#xA;&#xA;</xsl:text>
  <hr/>
</xsl:template>

<xsl:template match="issue" mode="toc">
 <xsl:choose>
 <xsl:when test="./title = 'Dummy'">
 <xsl:text>&#xA;</xsl:text>
 <tr><xsl:if test="((position() mod 3) = 0)">
    <xsl:attribute name="style">background-color:#FFA</xsl:attribute>
   </xsl:if>
   <xsl:text>&#xA;</xsl:text>
   <td
     ><a
       ><xsl:attribute name="href"
         >#<xsl:value-of select='@keyword'
       /></xsl:attribute
       ><xsl:value-of select="/issues/@prefix"
       /><xsl:number value="position()" format="1"
     /></a
   ></td>
   <td>-<!--* batch *--></td>
   <td>-<!--* cluster *--></td>
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="@status"/></td>
   <!--*
   <td>-<! - - * locus, clause * - - ></td>
   *-->
   <xsl:text>&#xA;</xsl:text>
   <td>-<!--* originator *--></td>
   <td>-<!--* responsible *--></td>
   <xsl:text>&#xA;</xsl:text>
   <td>[Dummy]</td>
 </tr>
 </xsl:when>
 <xsl:otherwise>
 <tr><xsl:if test="((position() mod 3) = 0)">
    <xsl:attribute name="style">background-color:#FFA</xsl:attribute>
   </xsl:if>
   <xsl:text>&#xA;</xsl:text>
   <td
     ><a
       ><xsl:attribute name="href"
         >#<xsl:value-of select='@keyword'
       /></xsl:attribute
       ><xsl:value-of select="/issues/@prefix"
       /><xsl:number value="position()" format="1"
     /></a
   ></td>
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="@batch"/></td>
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="@cluster"/></td>
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="@status"/></td>
   <!--*
   <td><xsl:value-of select="@locus"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="@clause"/></td>
   *-->
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="@originator"/></td>
   <xsl:text>&#xA;</xsl:text>
   <td>
      <xsl:choose>
      <xsl:when test="@responsible">
        <xsl:value-of select="@responsible"/>
      </xsl:when>
      <xsl:when test="@batch='C'">
        editor
      </xsl:when>
      <xsl:when test="@batch='B'">
        chairs
      </xsl:when>
      </xsl:choose>
   </td>
   <xsl:text>&#xA;</xsl:text>
   <td><xsl:value-of select="title"/></td>
   <xsl:text>&#xA;</xsl:text>
 </tr>
 </xsl:otherwise>
 </xsl:choose>
 <xsl:text>&#xA;&#xA;</xsl:text>
</xsl:template>


<xsl:template match="issues/title"/>
<xsl:template match="issues/header"/>

<xsl:template match="issue">
 <xsl:text>&#xA;&#xA;</xsl:text>
 <div class='issue'>
  <xsl:choose>
    <xsl:when test="@status='proposed'">
      <xsl:attribute name='style'>color: A0A000</xsl:attribute>       
    </xsl:when>
    <xsl:when test="@status='unassigned'">
      <xsl:attribute name='style'>color: A00000</xsl:attribute>       
    </xsl:when>
    <xsl:when test="@status='active'">
      <xsl:attribute name='style'>color: red</xsl:attribute>       
    </xsl:when>
    <xsl:when test="@status='draft'">
      <xsl:attribute name='style'>color: 002080</xsl:attribute>
      <!--* 000044 *-->
    </xsl:when>
    <xsl:when test="@status='resolved'">
      <xsl:attribute name='style'>color: 008000</xsl:attribute>       
      <!--* 004400 *-->
    </xsl:when>
    <xsl:when test="@status='postponed'">
      <xsl:attribute name='style'>color: 808080</xsl:attribute>       
      <!--* 003644 *--><!--* toc IS A0A0A0, but text needs to be darker *-->
    </xsl:when>
    <xsl:when test="(@status='abandoned' or title='Dummy')">
      <xsl:attribute name='style'>color: 808000</xsl:attribute>       
      <!--* 443600 *-->
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name='style'>color: green</xsl:attribute>       
    </xsl:otherwise>
  </xsl:choose>

  <xsl:text>&#xA;</xsl:text>
  <xsl:choose>
  <xsl:when test="./title = 'Dummy'">
  <h2><xsl:value-of select="/issues/@prefix"
    /><xsl:number value="position()" format="1. "/>
    <a><xsl:attribute name='name'>
         <xsl:choose>
              <xsl:when test='@keyword'><xsl:value-of select='@keyword'/></xsl:when>
           <xsl:otherwise><xsl:text>AEN</xsl:text><xsl:value-of select="generate-id(this)"/></xsl:otherwise>
         </xsl:choose>
       </xsl:attribute>
    </a>
   This issue number has been retired.</h2>
  </xsl:when>
  <xsl:otherwise>
  <h2><xsl:value-of select="/issues/@prefix"
    /><xsl:number value="position()" format="1. "/>
    <a><xsl:attribute name='name'>
         <xsl:choose>
              <xsl:when test='@keyword'><xsl:value-of select='@keyword'/></xsl:when>
           <xsl:otherwise><xsl:text>AEN</xsl:text><xsl:value-of select="generate-id(this)"/></xsl:otherwise>
         </xsl:choose>
       </xsl:attribute>
       <u><xsl:value-of select='@keyword'/></u>
       <xsl:text>:  </xsl:text>
       <xsl:apply-templates select='title' mode='title'/>
<!--*  (<xsl:value-of select='@status'/>) *-->
    </a>
  </h2>
  <xsl:text>&#xA;</xsl:text>
  <div>
    <xsl:if test="@priority='editorial'">
      <xsl:attribute name='style'>font-style: italic</xsl:attribute>
      <b>Editorial.</b>
    </xsl:if>
    <small>
      <xsl:if test="@batch">
        Issue Class: <b><xsl:value-of select="@batch"/></b>
      </xsl:if>
      Locus: <b><xsl:value-of select="@locus"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="@clause"/>
      </b>
      <xsl:choose>
        <xsl:when test="@cluster">
          Cluster: <b><xsl:value-of select="@cluster"/></b>
        </xsl:when>
        <xsl:otherwise>
          (No cluster assigned yet)
        </xsl:otherwise>
      </xsl:choose>
      Status: <b><xsl:value-of select='@status'/></b> 
      <br/>
      <xsl:choose>
      <xsl:when test="@responsible">
        Assigned to: <b><xsl:value-of select="@responsible"/></b>
      </xsl:when>
      <xsl:when test="@batch='C'">
        Assigned to: <b>editor</b>
      </xsl:when>
      <xsl:when test="@batch='B'">
        Assigned to: <b>chairs</b>
      </xsl:when>
      </xsl:choose>
      Originator: <b><xsl:value-of select='@originator'/></b> 
      <xsl:if test='@source'> 
        Source: <a><xsl:attribute name='href'
           ><xsl:value-of select='@source'/></xsl:attribute>
           <xsl:value-of select='@source'/></a>
      </xsl:if>
    </small>
    <xsl:apply-templates/>
  </div>
  </xsl:otherwise>
  </xsl:choose>
 </div>
</xsl:template>

<xsl:template match="issue/title" mode="title">
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="issue/title"/>

<xsl:template match='description'>
  <xsl:text>&#xA;</xsl:text>
  <h3>Description</h3>
  <xsl:text>&#xA;</xsl:text>
  <div>
    <xsl:text>&#xA;</xsl:text>
    <xsl:apply-templates/>
    <xsl:text>&#xA;</xsl:text>
  </div>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>
<xsl:template match='references'>
  <xsl:text>&#xA;</xsl:text>
  <h3>Interactions and Input</h3>
  <xsl:text>&#xA;</xsl:text>
  <div>
   <xsl:text>&#xA;</xsl:text>
   <xsl:apply-templates/>
   <xsl:text>&#xA;</xsl:text>
  </div>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>

<xsl:template match='interaction'>
  <xsl:text>&#xA;</xsl:text>
  <p>Cf. <a><xsl:attribute name='href'>#<xsl:value-of select='@issue'
     /></xsl:attribute><xsl:value-of select='id(@issue)/title'/></a></p>
  <xsl:apply-templates/>
</xsl:template>
<xsl:template match='input'>
  <xsl:text>&#xA;</xsl:text>
  <p><a><xsl:attribute name='href'><xsl:value-of select='@href'
    /></xsl:attribute>Input from </a>
  <xsl:value-of select='@author'/>:</p>
  <xsl:text>&#xA;</xsl:text>
  <div style='margin-left: 2em; margin-right: 2em;'>
    <xsl:apply-templates/>
  </div>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>
<xsl:template match='proposal'>
  <h3>Proposed Resolution</h3>
  <div><xsl:apply-templates/></div>
</xsl:template>
 <xsl:template match='resolution'>
  <h3>Actual Resolution</h3>
  <div><xsl:apply-templates/></div>
</xsl:template>

<xsl:template match="p">
  <xsl:text>&#xA;</xsl:text>
  <p><xsl:apply-templates/></p>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>

<xsl:template match='olist'>
  <xsl:text>&#xA;</xsl:text>
  <ol>
    <xsl:for-each select='item'>
      <xsl:text>&#xA;</xsl:text>
      <li><xsl:apply-templates/></li>
    </xsl:for-each>
    <xsl:text>&#xA;</xsl:text>
  </ol>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>

<xsl:template match='ulist'>
  <xsl:text>&#xA;</xsl:text>
  <ul>
    <xsl:for-each select='item'>
      <xsl:text>&#xA;</xsl:text>
      <li><xsl:apply-templates/></li>
    </xsl:for-each>
    <xsl:text>&#xA;</xsl:text>
  </ul>
  <xsl:text>&#xA;</xsl:text>
</xsl:template>

<xsl:template match='eg'>
<div class='eg'>
 <table cellpadding='5' border='1' bgcolor='#bbffff' width='100%'>
  <tr>
   <td>
    <xsl:choose>
     <xsl:when test="@role='error'">
      <pre style='color: red'><xsl:apply-templates/></pre>
     </xsl:when>
     <xsl:otherwise>
      <pre><xsl:apply-templates/></pre>
     </xsl:otherwise>
    </xsl:choose>
   </td>
  </tr>
 </table>
</div>
</xsl:template>

<xsl:template match="code"><code><xsl:apply-templates/></code></xsl:template>
<xsl:template match="emph"><em><xsl:apply-templates/></em></xsl:template>
<xsl:template match="b"><b><xsl:apply-templates/></b></xsl:template>

<xsl:template match='link'>
  <a><xsl:if test='@href'>
    <xsl:attribute name='href'><xsl:value-of select='@href'/></xsl:attribute>
  </xsl:if>
  <xsl:if test='@name'>
    <xsl:attribute name='name'><xsl:value-of select='@name'/></xsl:attribute>
  </xsl:if><xsl:apply-templates/></a>
</xsl:template>

</xsl:stylesheet>

