You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2002/05/30 18:23:42 UTC

cvs commit: jakarta-avalon/src/documentation/skins/avalon-site/xslt/html book2menu.xsl document2html.xsl site2xhtml.xsl

nicolaken    02/05/30 09:23:42

  Added:       src/documentation/skins/avalon-site/xslt/html book2menu.xsl
                        document2html.xsl site2xhtml.xsl
  Log:
  Updating docs generation to Cocoon 2.0.3 used in Centipede;
  cleaning the structure related to documentation.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/src/documentation/skins/avalon-site/xslt/html/book2menu.xsl
  
  Index: book2menu.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="1.0">
  
    <xsl:param name="resource"/>
  
    <xsl:template match="book">
      <menu>
        <xsl:apply-templates/>
      </menu>
    </xsl:template>
  
    <xsl:template match="project">
    </xsl:template>
  <!--
    <xsl:template match="menu[position()=1]">
      <xsl:apply-templates/>
    </xsl:template>
  -->
    <xsl:template match="menu">
      <div id="submenu">
        <h4><xsl:value-of select="@label"/></h4>
         <ul>      
          <xsl:apply-templates/>
        </ul>     
      </div>     
    </xsl:template>
  
    <xsl:template match="menu-item">
     <xsl:if test="not(@type) or @type!='hidden'">
      <li> 
         <xsl:choose>
           <xsl:when test="@href=$resource">
            <xsl:value-of select="@label"/>
           </xsl:when>
           <xsl:otherwise>
            <a href="{@href}"><xsl:value-of select="@label"/></a>
          </xsl:otherwise>
         </xsl:choose>
       </li>  
     </xsl:if>
    </xsl:template>
  
    <xsl:template match="external">
      <xsl:if test="not(@type) or @type!='hidden'">
       <li>
        <a href="{@href}"><xsl:value-of select="@label"/></a>
       </li> 
      </xsl:if>
    </xsl:template>
  
    <xsl:template match="node()|@*" priority="-1"/>
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-avalon/src/documentation/skins/avalon-site/xslt/html/document2html.xsl
  
  Index: document2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="1.0">
  
  <!-- ====================================================================== -->
  <!-- document section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="/">
    <!-- checks if this is the included document to avoid neverending loop -->
    <xsl:if test="not(book)">
        <document>
        <xsl:choose>
  		<xsl:when test="document/header/title">
  		      <title><xsl:value-of select="document/header/title"/></title>
  		</xsl:when>
  		<xsl:otherwise>
  			<title>NO TITLE</title>
  		</xsl:otherwise>
  	</xsl:choose>
        <body>
          <xsl:apply-templates/>
           <xsl:if test="/document/header/authors">
              <div id="authors">       
                 <xsl:for-each select="/document/header/authors/person">
                       <xsl:choose>
                          <xsl:when test="position()=1">by&#160;</xsl:when>
  
                          <xsl:otherwise>,&#160;</xsl:otherwise>
                       </xsl:choose>
  
                       <xsl:value-of select="@name" />
                    </xsl:for-each>
                </div>
           </xsl:if>           
        </body>
        </document>
     </xsl:if>
     
     <xsl:if test="book">
      <xsl:apply-templates/>
     </xsl:if>
    </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- header section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="header">
    <!-- ignore on general document -->
   </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- body section -->
  <!-- ====================================================================== -->
  
     <xsl:template match="section">
  
  	 <xsl:variable name = "level" select = "count(ancestor::section)+1" />
  	 
  	 <xsl:choose>
  	 	<xsl:when test="$level=1">
  	 	  <h2><xsl:value-of select="@title"/></h2>
  	 	</xsl:when>
  	 	<xsl:when test="$level=2">
  	 	  <h3><xsl:value-of select="@title"/></h3>
  	 	</xsl:when>
  	 	<xsl:when test="$level=3">
  	 	  <h4><xsl:value-of select="@title"/></h4>
  	 	</xsl:when>
  	 	<xsl:otherwise>
  	 	  <h5><xsl:value-of select="@title"/></h5>
  	 	</xsl:otherwise>
  	 </xsl:choose>
  
  	 <div class="section"><xsl:apply-templates/></div>	 
  	      
  	</xsl:template>  
  
  
     <xsl:template match="s1">
  	 <h2><xsl:value-of select="@title"/></h2>
  	 <div class="section"><xsl:apply-templates/></div>	 
     </xsl:template>  
  
     <xsl:template match="s2">
  	 <h3><xsl:value-of select="@title"/></h3>
  	 <div class="section"><xsl:apply-templates/></div>	 
     </xsl:template>  
     
     <xsl:template match="s3">
  	 <h4><xsl:value-of select="@title"/></h4>
  	 <div class="section"><xsl:apply-templates/></div>	 
     </xsl:template>  
     
     <xsl:template match="s4">
  	 <h5><xsl:value-of select="@title"/></h5>
  	 <div class="section"><xsl:apply-templates/></div>	 
     </xsl:template>  
           	    
  <!-- ====================================================================== -->
  <!-- footer section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="footer">
    <!-- ignore on general documents -->
   </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- paragraph section -->
  <!-- ====================================================================== -->
  
    <xsl:template match="p">
      <p><xsl:apply-templates/></p>
    </xsl:template>
  
    <xsl:template match="note">
     <p><i><xsl:apply-templates/></i></p>
    </xsl:template>
  
    <xsl:template match="source">
      <div class="code"><pre><xsl:apply-templates/></pre></div>
    </xsl:template>
    
    <xsl:template match="fixme">
     <!-- ignore on documentation -->
    </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- list section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="ul|ol|dl">
    <blockquote>
     <xsl:copy>
      <xsl:apply-templates/>
     </xsl:copy>
    </blockquote>
   </xsl:template>
   
   <xsl:template match="li">
    <xsl:copy>
     <xsl:apply-templates/>
    </xsl:copy>
   </xsl:template>
  
   <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 -->
  <!-- ====================================================================== -->
  
    <xsl:template match="table">
      <table>
        <caption><xsl:value-of select="caption"/></caption>
        <xsl:apply-templates/>
      </table>
    </xsl:template>
  
    <xsl:template match="tr">
      <tr><xsl:apply-templates/></tr>
    </xsl:template>
  
    <xsl:template match="th">
      <td colspan="{@colspan}" rowspan="{@rowspan}">
          <b><xsl:apply-templates/></b>&#160;
      </td>
    </xsl:template>
  
    <xsl:template match="td">
      <td colspan="{@colspan}" rowspan="{@rowspan}">
          <xsl:apply-templates/>&#160;
      </td>
    </xsl:template>
  
    <xsl:template match="tn">
      <td colspan="{@colspan}" rowspan="{@rowspan}">
        &#160;
      </td>
    </xsl:template>
    
    <xsl:template match="caption">
      <!-- ignore since already used -->
    </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- markup section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="strong">
     <b><xsl:apply-templates/></b>
   </xsl:template>
  
   <xsl:template match="em">
      <i><xsl:apply-templates/></i>
   </xsl:template>
  
   <xsl:template match="code">
    <span class="fixed"><xsl:apply-templates/></span>
   </xsl:template>
  
   <xsl:template match="sup">
    <sup><xsl:apply-templates/></sup>
   </xsl:template>
  
   <xsl:template match="sub">
    <sub><xsl:apply-templates/></sub>
   </xsl:template>
   
  <!-- ====================================================================== -->
  <!-- images section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="figure">
    <p>
    <xsl:choose>
     <xsl:when test="string(@width) and string(@height)">
     <img src="{@src}" alt="{@alt}" width="{@width}" height="{@height}"/>
     </xsl:when>
     <xsl:otherwise>
     <img src="{@src}" alt="{@alt}"/>
     </xsl:otherwise>
    </xsl:choose>
    </p>
   </xsl:template>
   
   <xsl:template match="img">
     <img src="{@src}" alt="{@alt}"/>
   </xsl:template>
  
   <xsl:template match="icon">
     <img src="{@src}" alt="{@alt}"/>
   </xsl:template>
  
  <!-- ====================================================================== -->
  <!-- links section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="link">
     <a href="{@href}"><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>  
  
  <!-- ====================================================================== -->
  <!-- specials section -->
  <!-- ====================================================================== -->
  
   <xsl:template match="br">
    <br/>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  jakarta-avalon/src/documentation/skins/avalon-site/xslt/html/site2xhtml.xsl
  
  Index: site2xhtml.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="1.0">
  <xsl:template match="/">
  <html>
  <head>
  			<title><xsl:value-of select="/site/document/title"/></title>
  			<meta name="author" value="Leo Simons" />
  			<meta name="email" value="leosimons@apache.org" />
  			
  			<link rel="stylesheet" type="text/css" href="skin/common.css" />
  </head>
  <body>
  			<!-- header -->
  			<div id="header"><table width="100%" border="0" cellpadding="0" cellspacing="0">
  						<tr>
  									<td id="jakartaLogoTD" valign="middle" align="left"><a href="@group-logo.href@"><img id="jakartaLogo" src="@group-logo.src@" border="0"/></a></td>
  									<td id="projectLogoTD" valign="middle" align="right"><a href="@project-logo.href@"><img id="projectLogo" src="@project-logo.src@" border="0"/></a></td>
  						</tr>
  			</table></div>
  			<!-- end header -->
  			<!-- breadcrumb trail (javascript-generated) -->
  			<div id="breadcrumbs">
                <a href="@link1.href@" class="menu">@link1@ &gt;</a>
                <a href="@link2.href@" class="menu">@link2@ &gt;</a>
                <a href="@link3.href@" class="menu">@link3@</a>    			
  				<script language="JavaScript1.2" type="text/javascript">
  				<!--
  					function sentenceCase(str) {
  						var lower = str.toLowerCase();
  						return lower.substr(0,1).toUpperCase() + lower.substr(1);
  					}
  					function getDirsAsArray() {
  						var trail = document.location.pathname.split("/");
  						var lastdir = (trail[trail.length-1].indexOf(".html") != -1)? trail.length-2 : trail.length-1;
  						var urlprefix = "/avalon/";
  						var postfix = " &gt"; 
  						for(var i = 1; i <= lastdir; i++) {
  							document.writeln('<a href=' + urlprefix + trail[i] + ' class="menu">' + sentenceCase(trail[i]) + '</a>'+postfix);
  							urlprefix += trail[i] + "/";
  							if(i == lastdir-1) postfix = ":";
  						}
  					}
  					getDirsAsArray();
  				// -->
  				</script>
  			</div>
  			<!-- end breadcrumb trail -->
  			<!-- main section of page -->
  			<div id="main"><table width="100%" border="0" cellpadding="0" cellspacing="0">
  						<tr>
  									<td valign="top">
  									
  	<!-- menu -->		
  	<div id="menu">						
  	  <xsl:copy-of select="/site/menu/node()|@*"/>
      </div>
  									<!-- end menu column -->
  									</td>
  									<!-- spacer -->
  									<td width="10">&#160;</td>
   									<td valign="top" width="100%">
  									<!-- contents column -->
  										
  	<!-- contents -->								
      <div id="title"><h1><xsl:value-of select="/site/document/title"/></h1></div>
        <div id="contents">    
         <xsl:copy-of select="/site/document/body/node()|@*"/>
        </div>
  									<!-- end contents column -->
  
  <script language="JavaScript">
  <![CDATA[<!-- 
  document.write("last modified: " + document.lastModified); 
  //  -->]]>
  </script>									</td>
  						</tr>
  			</table></div>
  			<!-- end main section of page -->
  			<!-- footer -->
  			<div id="footer">
  						 Copyright &#x00A9;@year@ @vendor@. All Rights Reserved.
  
  			</div>
    <a href="http://jakarta.apache.org/ant/"><img align="right" src="skin/images/ant_logo_medium.gif" alt="Ant Logo" border="0"/></a> 
    <a href="http://xml.apache.org/cocoon/"><img align="right" src="skin/images/built-with-cocoon.gif" alt="Cocoon Logo" border="0"/></a> 
    <a href="http://www.krysalis.org/"><img align="right" src="skin/images/krysalis-logo-small.gif" alt="Krysalis Logo" border="0"/></a> 
    <a href="http://www.krysalis.org/centipede/"><img align="right" src="skin/images/centipede-logo-small.gif" alt="Krysalis Centipede Logo" border="0"/></a> 
  
  			<!-- end footer -->
  			
  </body>
  </html>
  </xsl:template>
  </xsl:stylesheet>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>