<?xml version="1.0"?>

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

 <xsl:param name="stylebook.project"/>
 <xsl:param name="copyright"/>
 <xsl:param name="id"/>

<!-- ====================================================================== -->
<!-- document section -->
<!-- ====================================================================== -->

 <xsl:template match="/">
  <!-- checks if this is the included document to avoid neverending loop -->
  <xsl:if test="not(book)">
<html>
<head>
<title><xsl:value-of select="document/header/title"/></title>
<link rel="stylesheet" type="text/css" href="resources/style.css"/>
</head>
<body bgcolor="#c4dbec" topmargin="2" leftmargin="0" marginheight="2" marginwidth="0">

<a name="top"></a>
<!-- MAIN TABLE START -->
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tr>
   <td rowspan="3" bgcolor="#264460">&#160;</td>
   <td rowspan="3" colspan="2" bgcolor="#264460"><img alt="logo" src="resources/logo.gif" width="105" height="42" border="0"/></td>
   <td align="right" valign="top" bgcolor="#264460"><img alt="deco" src="resources/logo-corner1.gif" width="5" height="5" border="0"/></td>
   <td colspan="4"></td>
  </tr>
  <tr>
   <td bgcolor="#264460"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
   <td rowspan="2" bgcolor="#101c27">&#160;</td>
   <!-- TITLE START -->
   <td rowspan="2" valign="bottom" bgcolor="#101c27"><span class="title"><xsl:value-of select="document/header/title"/>&#160;</span></td>
   <!-- TITLE START -->
   <!-- LINKS START -->
   <td rowspan="2" align="right" valign="bottom" bgcolor="#101c27"><a class="nav" href="http://www.apache.org">www.apache.org</a>&#160;&#160;&#160;<a class="nav" href="http://www.w3c.org">www.w3c.org</a></td>
   <!-- LINKS END -->
   <td rowspan="2" bgcolor="#101c27">&#160;</td>
  </tr>
  <tr>
   <td valign="bottom" bgcolor="#264460"><img alt="deco" src="resources/logo-corner2.gif" width="5" height="5" border="0"/></td>
  </tr>
  <tr>
   <td></td>
   <td valign="bottom" bgcolor="#101c27"><img alt="deco" src="resources/title-corner.gif" width="5" height="5" border="0"/></td>
   <td colspan="6" align="right" bgcolor="#101c27"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
  </tr>
  <tr>
   <td colspan="4">&#160;</td>
   <td rowspan="2">&#160;</td>
   <!-- NAVIGATION LEVEL START -->
   <td rowspan="2" colspan="3"><a class="navpath" href="index.html">xml.apache.org</a><span class="path"> > <xsl:value-of select="$id"/></span></td>
   <!-- NAVIGATION LEVEL END -->
  </tr>
  <tr>
   <td colspan="3" bgcolor="#3e719e"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
   <td align="right" valign="top" bgcolor="#3e719e"><img alt="deco" src="resources/nav-corner-top.gif" width="5" height="5" border="0"/></td>
  </tr>
  <tr>
   <td colspan="3" valign="top" bgcolor="#3e719e">
      <!-- NAV TABLE -->
      <table width="120" cellspacing="0" cellpadding="1" border="0">
        <xsl:apply-templates select="document($stylebook.project)"/>
      </table>
      <!-- END NAV TABLE -->
   </td>
   <td bgcolor="#3e719e"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
   <td rowspan="3" bgcolor="#ffffff">&#160;</td>
   <td rowspan="3" colspan="2" valign="top" bgcolor="#ffffff">
      <!-- CONTENT TABLE -->
      <br />
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <!-- CONTENT ROW -->
        <tr>
         <td>
<xsl:apply-templates/>
         </td>
        </tr>
        <!-- END CONTENT ROW -->
        <!-- FOOTER ROW -->
        <tr>
          <td valign="top">
          <br />
          <span class="copy">Copyright &#169; 1999-2001 The Apache Software Foundation.  All Rights Reserved.</span></td>
          <td align="right" valign="top">
          <br />
          <a class="navtop" href="#top">top ^</a></td>
        </tr>
        <!-- END FOOTER ROW -->
      </table>
      <!-- END CONTENT TABLE -->
   </td>
   <td rowspan="3" bgcolor="#ffffff">&#160;</td>
  </tr>
  <tr>
   <td colspan="3" bgcolor="#3e719e"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
   <td align="right" valign="bottom" bgcolor="#3e719e"><img alt="deco" src="resources/nav-bot-corner.gif" width="5" height="5" border="0"/></td>
  </tr>
  <tr>
   <td></td>
   <td colspan="3" bgcolor="#ffffff">&#160;</td>
  </tr>
  <tr>
   <td></td>
   <td valign="bottom" bgcolor="#ffffff"><img alt="deco" src="resources/cont-bot-corner.gif" width="5" height="5" border="0"/></td>
   <td colspan="6" bgcolor="#ffffff"><img alt="deco" src="resources/dot.gif" width="2" height="2" border="0"/></td>
  </tr>
  <tr>
   <td colspan="8"><br /></td>
  </tr>
</table>
<!-- MAIN TABLE END -->

</body>
</html>
   </xsl:if>
   
   <xsl:if test="book">
    <xsl:apply-templates/>
   </xsl:if>
  </xsl:template>

<!-- ====================================================================== -->
<!-- book section -->
<!-- ====================================================================== -->

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

  <xsl:template match="page|faqs|changes|todo|spec">
    <tr><td><xsl:if test="@id=$id"><img alt="pointer" src="resources/sel.gif" width="7" height="7" border="0"/></xsl:if></td><td><xsl:if test="@id=$id">
      <xsl:value-of select="@label"/>
    </xsl:if>
    <xsl:if test="@id!=$id">
      <a href="{@id}.html"><xsl:value-of select="@label"/></a>
    </xsl:if>
    </td></tr>
  </xsl:template>

  <xsl:template match="external">
    <tr><td></td><td><a class="nav" href="{@href}"><xsl:value-of select="@label"/></a></td></tr>
  </xsl:template>

  <xsl:template match="separator">
    <tr><td/><td><br/></td></tr>
  </xsl:template>
  
<!-- ====================================================================== -->
<!-- header section -->
<!-- ====================================================================== -->

 <xsl:template match="header">
  <!-- ignore on general document -->
 </xsl:template>

<!-- ====================================================================== -->
<!-- body section -->
<!-- ====================================================================== -->

  <xsl:template match="s1">
<!--    <br/>
    <div class="head"><xsl:value-of select="@title"/></div> -->
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s2">
    <br/>
    <div class="head"><xsl:value-of select="@title"/></div>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s3">
    <br/>
    <div class="head"><xsl:value-of select="@title"/></div>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s4">
    <br/>
    <div class="head"><xsl:value-of select="@title"/></div>
    <xsl:apply-templates/>
  </xsl:template>

<!-- ====================================================================== -->
<!-- footer section -->
<!-- ====================================================================== -->

 <xsl:template match="footer">
  <!-- ignore on general documents -->
 </xsl:template>

<!-- ====================================================================== -->
<!-- paragraph section -->
<!-- ====================================================================== -->

  <xsl:template match="note">
    <div align="center">
      <table border="0" cellpadding="2" cellspacing="2">
        <tr>
          <td bgcolor="#c4cbd8">
            <font color="#023264" size="-1"><xsl:apply-templates/></font>
          </td>
        </tr>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="source">
    <hr size="1" width="50%" align="left"/>
    <pre>
      <xsl:apply-templates/>
    </pre>
    <hr size="1" width="50%" align="left"/>
  </xsl:template>

  <xsl:template match="fixme">
   <!-- ignore on documentation -->
  </xsl:template>

<!-- ====================================================================== -->
<!-- list section -->
<!-- ====================================================================== -->

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

 <xsl:template match="dt">
  <li>
   <strong><xsl:value-of select="."/></strong>
   <xsl:text> - </xsl:text>
   <xsl:apply-templates select="dd"/>   
  </li>
 </xsl:template>
 
<!-- ====================================================================== -->
<!-- table section -->
<!-- ====================================================================== -->

<!-- since we cloned the XHTML model, we don't need any futher styling      -->

<!-- ====================================================================== -->
<!-- markup section -->
<!-- ====================================================================== -->

<!-- since we cloned the XHTML model, we don't need any futher styling      -->
 
<!-- ====================================================================== -->
<!-- images section -->
<!-- ====================================================================== -->
 <xsl:template match="figure|img|icon">
  <img src="{@src}" alt="{@alt}" class="{name(.)}"/>
 </xsl:template>

 <xsl:template match="document|faqs|changes|group">
    <tr><td><xsl:if test="@id=$id"><img alt="pointer"
    src="resources/sel.gif" width="7" height="7"
    border="0"/></xsl:if></td><td><xsl:if test="@id=$id"><div class="navsel">
      <xsl:value-of select="@label"/>
</div>
    </xsl:if>
    <xsl:if test="@id!=$id">
      <a class="nav" href="{@id}.html"><xsl:value-of select="@label"/></a>
    </xsl:if>
    </td></tr>
<!--    <tr><td></td><td><a class="nav"
href="{@id}.html"><xsl:value-of select="@label"/></a></td></tr> -->
<!--   <xsl:apply-templates/> -->
 </xsl:template>
<!-- ====================================================================== -->
<!-- links section -->
<!-- ====================================================================== -->

 <xsl:template match="link">
   <a href="{@idref}.html"><xsl:apply-templates/></a>
 </xsl:template>

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

 <xsl:template match="jump">
   <a href="{@href}#{@anchor}"><xsl:apply-templates/></a>
 </xsl:template>

 <xsl:template match="fork">
   <a href="{@href}" target="_blank"><xsl:apply-templates/></a>
 </xsl:template>

 <xsl:template match="anchor">
   <a name="{@id}"><xsl:comment>anchor</xsl:comment></a>
 </xsl:template>  


  <xsl:template match="@*|*|text()|processing-instruction()">
    <xsl:copy>
      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

