<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xd="http:www.pnp-software.com/XSLTdoc" xmlns:ax="http://control.ee.ethz.ch/XWeaver/AspectX" exclude-result-prefixes="#all" version="2.0">
      
      
<xd:doc type="stylesheet">
          Generates the HTML page that documents an aspect program.
          
<xd:author>A. Pasetti, I. Birrer</xd:author>
          
<xd:cvsId>$Id: GenerateAspectPage.xsl 2 2005-01-19 16:09:12Z ibirrer $</xd:cvsId>
          
<xd:copyright>2004, P&amp;P Software GmbH</xd:copyright>
      
</xd:doc>
      
      
<xd:doc>
          This template generates the HTML page that documents one aspect program. 
          The name of the aspect program is passed as the "aspectName" template parameter.
          The "databaseFileName" parameter holds the name of the database file.
          The "configDoc" parameter holds the top-level element of the AspectXdoc configuration 
          file.
          This template calls the template "GenerateBanner". This template is not included
          here because it is assumed that it is already included by the calling template.
      
</xd:doc>
      
<xsl:template name="GenerateAspectPage" exclude-result-prefixes="#all">
         
<xsl:param name="Database" />
         
<xsl:param name="aspectName" />
         
<xsl:param name="configDoc" />

         
<!-- Define a variable holding a white space -->
         
<xsl:variable name="whiteSpace" select="' '" />

         
<!-- Recover the name of the file holding the aspect -->
         
<xsl:variable name="SourceFile" select="$Database/Entry[@name=$aspectName]/@file" />
            
         
<!-- Construct the unqualified name of the file holding the aspect -->
         
<xsl:variable name="UnqualifiedSourceFile" select="$SourceFile" />

         
<!-- Recover the name of the group (if any) associated to this aspect -->
         
<xsl:variable name="Group" select="$Database/Entry[@name=$aspectName]/@group" />
         
         
<!-- Open the file holding the aspect definition and extract the aspect definition -->
         
<xsl:variable name="Aspect" select="document($Database/Entry[@name=$aspectName]/@uri)/ax:aspect" />
         
             
<html>
                
<head>
                  
<title><xsl:value-of select="$configDoc/Header" /></title>
                  
<link href="AspectXdoc.css" rel="stylesheet" type="text/css" />
                
</head>
                
<body>
                
<xsl:call-template name="GenerateBanner"><xsl:with-param name="index" select="'0'" /></xsl:call-template>
                  
<h1><xsl:value-of select="$aspectName" /> Aspect<br />
                        
<xsl:if test="$Group">
                              
<small>[<a class="el"><xsl:attribute name="href">Group_<xsl:value-of select="$Group" />.html</xsl:attribute><xsl:value-of select="$Group" /> Group</a>]</small>
                         
</xsl:if>
                  
</h1>
                  This aspect is defined in file: 
<code><a class="el"><xsl:attribute name="href"><xsl:value-of select="$SourceFile" /></xsl:attribute><xsl:value-of select="$UnqualifiedSourceFile" /></a></code>
            
                  
<!-- Generate the description section at the beginning of the documentation page -->
                  
<hr /><a name="_description" /><h2>Aspect Description</h2>
                  
                  
<xsl:apply-templates select="$Aspect/ax:description/node()" />
                    
                  
<xsl:if test="$Aspect/ax:description/ax:author">
                        
<dl><dt><b>Author:</b></dt><dd><xsl:value-of select="$Aspect/ax:description/ax:author" /></dd></dl>
                   
</xsl:if>
                    
                  
<xsl:if test="$Aspect/ax:description/ax:version">
                        
<dl><dt><b>Version:</b></dt><dd><xsl:value-of select="$Aspect/ax:description/ax:author" /></dd></dl>
                   
</xsl:if>

                  
<xsl:if test="$Aspect/ax:description/ax:see">
                        
<dl><dt><b>See also:</b></dt>
                        
<xsl:for-each select="$Aspect/ax:description/ax:see">
                              
<dd><a class="el"><xsl:attribute name="href">Aspect_<xsl:value-of select="." />.html</xsl:attribute><xsl:value-of select="." /></a></dd>
                        
</xsl:for-each>
                        
</dl>
                   
</xsl:if>
                   
                  
<!-- Generate the secion listing the includes in the aspect -->
                  
<xsl:if test="$Aspect/ax:include">
                  
<dl><dt><b>Includes:</b></dt>
                        
<xsl:for-each select="$Aspect/ax:include">
                              
<dd><a class="el" href="{concat('Aspect_', document(@href)/ax:aspect/@name ,'.html')}"><xsl:value-of select="document(@href)/ax:aspect/@name" /> <code>(<xsl:value-of select="@href" />)</code></a></dd>
                        
</xsl:for-each>
                        
</dl>
                  
</xsl:if>

                   
                   
                  
<table border="0" cellpadding="0" cellspacing="0" width="100%">               
                  
<!-- Generate the section listing the pointcuts in the aspect -->
                  
<tr><td /></tr>
                  
<tr><td colspan="2"><br><h2>Pointcuts</h2></br></td></tr>
                  
<xsl:for-each select="$Aspect/ax:pointcut">
                        
<tr><td class="memItemLeft" nowrap="nowrap" align="right" valign="top"><xsl:value-of select="substring-after(@type,':')" /></td>
                        
<td class="memItemRight" valign="bottom"><a class="el"><xsl:attribute name="href">#<xsl:value-of select="@name" /></xsl:attribute><xsl:value-of select="@name" /></a></td></tr>
                        
<tr><td class="mdescLeft"><xsl:value-of select="$whiteSpace" /></td><td class="mdescRight"><em><xsl:value-of select="substring-before(ax:description,'.')" /></em><br /></td></tr>
                  
</xsl:for-each>
                  
                  
<!-- Generate the section listing the advices in the aspect -->
                  
<tr><td /></tr>
                  
<tr><td colspan="2"><br><h2>Advices</h2></br></td></tr>
                  
<xsl:for-each select="$Aspect/ax:advice">
                        
<tr><td class="memItemLeft" nowrap="nowrap" align="right" valign="top"><xsl:value-of select="@type" /></td>
                        
<td class="memItemRight" valign="bottom"><a class="el"><xsl:attribute name="href">#<xsl:value-of select="@name" /></xsl:attribute><xsl:value-of select="@name" /></a></td></tr>
                        
<tr><td class="mdescLeft"><xsl:value-of select="$whiteSpace" /></td><td class="mdescRight"><em><xsl:value-of select="substring-before(ax:description,'.')" /></em><br /></td></tr>
                  
</xsl:for-each>
                  
</table>
                  
                  
<!-- Generate the detailed documentation of the pointcuts -->
                  
<hr /><h2>Pointcut Documentation</h2>
                  
<xsl:apply-templates select="$Aspect/ax:pointcut">
                    
<xsl:with-param name="isGlobalPointcut" select="true()" />
                  
</xsl:apply-templates> 
         
                  
<!-- Generate the detailed documentation of the advices -->
                  
<hr /><h2>Advice Documentation</h2>
                  
<xsl:for-each select="$Aspect/ax:advice">
                        
<!-- HTML Anchor -->
                        
<a name="{@name}" />
                        
                        
<!-- Advice title -->
                        
<div class="boxedTitle">
                          
<xsl:value-of select="@type" />
                          
<xsl:text> </xsl:text>
                          
<b><xsl:value-of select="@name" /></b>
                          (
<a href="{concat('Aspect_', ancestor::ax:aspect/@name, '.src.html#', generate-id(.) )}">source</a>)
                        
</div>
                        
                        
<!-- Advice documentation -->
                        
<p style="margin-left:10px"><b>Triplet: </b>
                          
<xsl:value-of select="substring-after(ax:pointcut/@type | ax:pointcutRef/@type, ':')" />
                          
<xsl:text> </xsl:text>
                          
<xsl:value-of select="@type" />
                          
<xsl:text> </xsl:text>
                          
<xsl:value-of select="ax:codeModifier/@type" />
                        
</p>
                        
<div style="margin-left:10px">
                          
<xsl:apply-templates select="ax:description/node()" />
                        
</div>
                        
                        
<!-- Generate Pointcuts local to the advice currently processed -->
                        
<xsl:apply-templates select="ax:pointcut">
                          
<xsl:with-param name="isGlobalPointcut" select="false()" />
                        
</xsl:apply-templates>
                        
<xsl:if test="ax:pointcutRef">
                          
<p style="margin-left:10px"><strong>Refers to global pointcut: </strong>
                            
<xsl:apply-templates select="ax:pointcutRef" />
                          
</p>
                        
</xsl:if>
               
</xsl:for-each>         
         
               
<!-- Generate the footer at the bottom of the page -->
                
<hr /><center><b><xsl:apply-templates select="$configDoc/Footer" /></b></center>
                
</body>
             
</html>
      
      
</xsl:template>
      
    
<xd:doc>
        Rule that catches elements that must not be copied to the general description field.
    
</xd:doc>
    
<xsl:template match="ax:author|ax:version|ax:see" />
    
    
<xd:doc>
      Documents a pointcut.
    
</xd:doc>
    
<xsl:template match="ax:pointcut">
      
<xsl:param name="isGlobalPointcut" select="false()" />
      
<!-- HTML Anchor -->
      
<xsl:if test="$isGlobalPointcut">
        
<a name="{@name}" />
        
<div class="boxedTitle">
          
<!-- Pointcut type -->
          
<xsl:value-of select="concat(substring-after(@type,':'), ' ')" />
          
<!-- Print the name of the pointcut -->
          
<b><xsl:value-of select="@name" /></b>
          
<!-- Link to the source -->
          (
<a href="{concat('Aspect_', parent::ax:aspect/@name, '.src.html#', generate-id(.) )}">source</a>)
          
<xsl:apply-templates select="ax:pointcut" />
        
</div>
      
</xsl:if>  
      
<!-- Pointcut description -->
      
<div style="margin-left:10px"><xsl:apply-templates select="ax:description/node()" /></div>
      
<xsl:if test="not( $isGlobalPointcut )">
        
<p style="margin-left:{(count(ancestor::ax:pointcut) + 1) * 10}"><strong>Local Pointcut: </strong>
        
<xsl:value-of select="concat(substring-after(@type,':'), ' ')" />
        
<!-- Print the name of the pointcut -->
        
<b><xsl:value-of select="@name" /></b>
        
<!-- Link to the source -->
        (
<a href="{concat('Aspect_', ancestor::ax:aspect/@name, '.src.html#', generate-id(.) )}">source</a>)
        
</p>
      
</xsl:if>
      
<xsl:if test="ax:pointcutRef">
        
<div style="margin-left:10px"><strong>Refers to global pointcut: </strong>
          
<xsl:apply-templates select="ax:pointcutRef" />
        
</div>
      
</xsl:if>
    
</xsl:template>
    
    
<xd:doc>
      Documents a pointcut reference
    
</xd:doc>
    
<xsl:template match="ax:pointcutRef">
      
<xsl:choose>
        
<xsl:when test="@aspect">
          
<!-- Pointcut is defined Externally -->
          
<xsl:value-of select="concat(substring-after(@type,':'), ' ')" /><a class="el" href="{concat('Aspect_', @aspect ,'.html','#',@ref)}"><xsl:value-of select="@ref" /></a> (<xsl:value-of select="@aspect" />)
        
</xsl:when>
        
<xsl:otherwise>
          
<!-- Pointcut is defined Locally -->
          
<xsl:value-of select="concat(substring-after(@type,':'), ' ')" /><a class="el" href="#{@ref}"><xsl:value-of select="@ref" /></a>
        
</xsl:otherwise>
      
</xsl:choose>
    
</xsl:template>
</xsl:stylesheet>






































v