<xsl:stylesheet xmlns:src="http://www.sdml.info/srcML/src" xmlns:cpp="http://www.sdml.info/srcML/cpp" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xw="http://www.pnp-software.com/XWeaver" xmlns:xd="http://www.pnp-software.com/XSLTdoc" xmlns:util="http://www.pnp-software.com/util" xmlns:ax="http://control.ee.ethz.ch/XWeaver/AspectX" version="2.0">
                
  
                   <xd:doc type="stylesheet">
    
<xd:short>Weaving Rule that adds a comment to a unit (source code file) </xd:short>
    
<xd:detail>
      
<ul> 
        
<li>srcML element:     <code>src:unit</code></li>
        
<li>advice type:       <code>add</code></li>
        
<li>codeModifier type: <code>comment</code></li>
      
</ul>
      
        
<xd:weaverRuleLinks pointcutType="src:unit" adviceType="add" codeModifierType="comment" />
    
</xd:detail>
    
<xd:cvsId>$Id$</xd:cvsId>
    
<xd:author>ibirrer</xd:author>
    
<xd:copyright>2004, P&amp;P Software GmbH</xd:copyright>
  
</xd:doc>

  
  
                   <xd:doc>
    Adds the the comment before the declaration
  
</xd:doc>

  
<xsl:template match="src:unit[ax:advice[@type='add' and position() = 1]/ax:codeModifier[@type='comment']]" mode="weaving">
    
    
<xsl:copy>
      
<xsl:copy-of select="@*" />
      
<!-- The current advice has to be deleted. Others must be preserved.  -->
      
<xsl:copy-of select="ax:advice[position() != 1]" />
      
      
<!-- Add comment -->
      
<ax:inserted>
        
<xsl:value-of select="xw:getCodeModifierContent(ax:advice[1]/ax:codeModifier)" />
        
<xsl:text>
</xsl:text>
      
</ax:inserted>
      
<!-- Add Rest -->
      
<xsl:copy-of select="node()[not(self::ax:advice)]" />
    
</xsl:copy>
  
</xsl:template>
</xsl:stylesheet>






































v