<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet
 [ <!ENTITY xnbsp "&amp;nbsp;">
   <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet version="1.0"
                xmlns="http://www.w3.org/TR/xhtml1/transitional"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Project Notebook XSLT translator stylesheet.

     Generates an HTML file you should name "notebook.html" so
     the relative links work.

     This is a *very rough* first cut at translating the Project Notebook
     XML document into HTML automatically.
     It must be broken up into a family of stylesheets which create
     the other documents in the web out of the project notebook,
     and also allow processing of partial project documents to form
     auxiliary documents (like bookmark lists)

-->

<xsl:include href="shared.xsl" /> <!-- shared definitions for I/S Project -->

<xsl:output method="html" indent="yes" media-type="text/html"/>


<!-- Root element: generate outermost HTML tags and title section.
     There is required structure in the DTD to help us out.
     Get some BODY and TABLE attrs from the Appearance element if it's there.
-->


<xsl:template match="/project">
    <HTML
     xmlns="http://www.w3.org/TR/xhtml1/transitional">

    <xsl:call-template name="head-element">
        <xsl:with-param name="title"><xsl:value-of select="@name"/> -- Project Notebook</xsl:with-param>
    </xsl:call-template>

    <xsl:element name="BODY" use-attribute-sets="body-attrs">

    <xsl:call-template name="title-block">
        <xsl:with-param name="title">Project Notebook</xsl:with-param>
        <xsl:with-param name="subtitle"><xsl:value-of select="/project/@name"/></xsl:with-param>
    </xsl:call-template>

    <TABLE BORDER="0" CELLSPACING="3" CELLPADDING="3" WIDTH="100%">

       <!-- TOC block with links to major sections -->
       <TR>
         <TH WIDTH="141" ALIGN="right">On this page:</TH>
         <TD>
           <A href="#description">Description</A> |
           <xsl:for-each select="schedule/checkpoint">
             <A href="#checkpoint-{position()}">Checkpoint <xsl:value-of select="position()"/></A> |
           </xsl:for-each>
           <A href="#status">Status</A> |
           <A href="#detail">Project Detail Pages</A> |
           <xsl:if test="project-db">
             <A href="#projectdb">ProjectDB Info</A> |
           </xsl:if>
           <A href="#contact">Contact</A>
         </TD>
       </TR>

       <!-- Table row with nothing but a horizontal rule -->
       <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>

       <TR>
          <xsl:element name="TH" use-attribute-sets="left-column">
            <STRONG>Headline Information</STRONG>
          </xsl:element>
          <TD>
          <xsl:apply-templates select="/project/status/summary" />
          </TD>
       </TR>

       <!-- Table row with nothing but a horizontal rule -->
       <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>

       <TR>
          <xsl:element name="TH" use-attribute-sets="left-column">
            <STRONG>Project Description</STRONG>
          </xsl:element>
          <TD>
            <A name="description">
              <xsl:apply-templates select="/project/description" />
            </A>
          </TD>
       </TR>

       <!-- Table row with nothing but a horizontal rule -->
       <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>

       <xsl:for-each select="schedule/checkpoint">
           <TR>
                <xsl:element name="TH" use-attribute-sets="left-column">
                 <STRONG>Checkpoint <xsl:value-of select="position()"/>:</STRONG>
                 <BR/><EM><xsl:value-of select="@caption"/></EM>
                </xsl:element>
              <TD>
                <A name="checkpoint-{position()}">
                   <xsl:apply-templates select="."/>
                </A>
              </TD>
           </TR>
           <!-- Table row with nothing but a horizontal rule -->
           <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>
        </xsl:for-each>

       <TR>
          <xsl:element name="TH" use-attribute-sets="left-column">
             <STRONG>Detailed Status</STRONG>
          </xsl:element>
          <TD>
             <A name="status">
               <xsl:apply-templates select="status/full" />
             </A>
          </TD>
       </TR>

       <!-- Table row with nothing but a horizontal rule -->
       <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>

       <TR>
            <xsl:element name="TH" use-attribute-sets="left-column">
               <STRONG>Project Detail Pages</STRONG>
            </xsl:element>
          <TD>
            <A name="detail">
             <UL>
                <LI><A HREF="projcomm.html">Communications</A></LI>
     
                <LI><A HREF="projdocs.html">Documents</A></LI>
     
                <LI><A HREF="projissues.html">Issues</A></LI>
     
                <LI><A HREF="projtasks.html">Tasks</A></LI>
     
                <xsl:if test="count(quarterly-goals)>0">
                  <LI><A HREF="projgoals.html">Quarterly Goals and
                  Achievements</A> </LI>
                </xsl:if>
             </UL>
            </A>
          </TD>
       </TR>

       <xsl:if test="project-db">
         <!-- Table row with nothing but a horizontal rule -->
         <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>
          
         <TR>
              <xsl:element name="TH" use-attribute-sets="left-column">
               <STRONG>Project Database Reference Information</STRONG>
              </xsl:element>
            <TD>
              <A name="projectdb">
               This information is also in the
              </A>
               <A>
               <xsl:attribute name="HREF">https://arachne.mit.edu/fcgi-bin/brlfcgi/brlpdb/projpage.html?projid=<xsl:value-of select="project-db/@projid"/></xsl:attribute>
               Project Database</A>.
               It is duplicated here for easy reference,
               but it may be out of date.
               <P/>
                <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="3" WIDTH="60%">
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                        <STRONG>Process / Performing<BR/>
                                Organization</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@process"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                        <STRONG>Practice</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@practice"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                        <STRONG>Status</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@status"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                        <STRONG>Priority</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@priority"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                           <STRONG>Sponsor</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@sponsor"/>
                           <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                           <STRONG>Project Leader</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@leader"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                           <STRONG>Commitment Level</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@commitment"/>
                        <BR/>
                     </TD>
                  </TR>
                  <TR>
                     <TD VALIGN="top" BGCOLOR="#CCCCCC">
                           <STRONG>Customer</STRONG>
                     </TD>
                     <TD VALIGN="top">
                        <xsl:value-of select="project-db/@customer"/>
                     <BR/>
                     </TD>
                  </TR>
               </TABLE>
          
               <P>
               <A>
               <xsl:attribute name="HREF">https://arachne.mit.edu/fcgi-bin/brlfcgi/brlpdb/projpage.html?projid=<xsl:value-of select="project-db/@projid"/></xsl:attribute>
               Project Database link:</A> <xsl:value-of select="@name"/>.
               </P>
            </TD>
         </TR>
       </xsl:if>

       <!-- Table row with nothing but a horizontal rule -->
       <TR><TD COLSPAN="2"><P><HR/></P></TD></TR>

       <TR>
            <xsl:element name="TH" use-attribute-sets="left-column">
                <STRONG>Contact Info</STRONG>
            </xsl:element>
          <TD>
            <A name="contact">
             Email:
            </A>
             <A>
             <xsl:attribute name="HREF">mailto:<xsl:value-of select="contact/text()"/></xsl:attribute>
             <STRONG>
             <xsl:value-of select="contact/text()"/>
             </STRONG></A>
          </TD>
       </TR>
    </TABLE>
         
    <xsl:call-template name="trailer-block">
        <xsl:with-param name="output">notebook</xsl:with-param>
    </xsl:call-template>
     
    </xsl:element> <!-- /body -->
    </HTML>
</xsl:template>


<!-- named template to produce list elements under checkpoint
-->
<xsl:template name="schedule-items">
    <xsl:param name="title">DefaultTitle</xsl:param>
    <xsl:param name="operands"/>
    <xsl:if test="count($operands)>0">
       <TR><TH ALIGN="left" colspan="3"><xsl:value-of select="$title"/></TH></TR>
       <TR><TD COLSPAN="3"><UL>
       <xsl:for-each select="$operands">
         <LI><xsl:apply-templates select="." /></LI>
       </xsl:for-each>
       </UL></TD></TR>
    </xsl:if>
</xsl:template>

<!-- subtemplate to crank out list of schedule items, used by deliverable
     and activity elements; mostly an excuse to try out callable templates.
-->
<xsl:template match="checkpoint">
    <TABLE BORDER="1" CELLSPACING="1" WIDTH="75%">
    <TR>
       <TD WIDTH="25%">
          <xsl:attribute name="BGCOLOR"><xsl:value-of select="$boxcolor"/></xsl:attribute>
          <!-- work around Netscape bug in rendering tables.. -->
          <P><BR/></P>
       </TD>
       <TD WIDTH="25%">
          <xsl:attribute name="BGCOLOR"><xsl:value-of select="$boxcolor"/>
          </xsl:attribute>
             <STRONG>Start Date</STRONG>
       </TD>
       <TD WIDTH="25%">
          <xsl:attribute name="BGCOLOR"><xsl:value-of select="$boxcolor"/>
          </xsl:attribute>
             <STRONG>End Date</STRONG>
       </TD>
    </TR>
    <TR>
       <TD WIDTH="25%" BGCOLOR="#CCCCCC">
             Scheduled
       </TD>
       <TD WIDTH="25%">
         <!-- work around Netscape bug in rendering tables.. -->
         <P>
         <xsl:value-of select="@scheduled-start"/>
         <BR/></P>
       </TD>
       <TD WIDTH="25%">
         <!-- work around Netscape bug in rendering tables.. -->
         <P>
         <xsl:value-of select="@scheduled-end"/>
         <BR/></P>
       </TD>
    </TR>
    <TR>
       <TD WIDTH="25%" BGCOLOR="#CCCCCC">
             Actual
       </TD>
       <TD WIDTH="25%">
         <!-- work around Netscape bug in rendering tables.. -->
         <P>
         <xsl:value-of select="@actual-start"/>
         <BR/></P>
       </TD>
       <TD WIDTH="25%">
         <!-- work around Netscape bug in rendering tables.. -->
         <P>
         <xsl:value-of select="@actual-end"/>
         <BR/></P>
       </TD>
    </TR>

    <!-- deliverables and activities lists -->
    <xsl:call-template name="schedule-items">
        <xsl:with-param name="title">Deliverables</xsl:with-param>
        <xsl:with-param name="operands" select="deliverable"/>
    </xsl:call-template>

    <xsl:call-template name="schedule-items">
        <xsl:with-param name="title">Activities</xsl:with-param>
        <xsl:with-param name="operands" select="activity"/>
    </xsl:call-template>

    </TABLE>
</xsl:template>

</xsl:stylesheet>
