axc.xsl

Includes

AspectX Compiler
This XSL stylesheet compiles a program written in AspectX into an XSL stylesheet. The resulting stylesheet is able to add advice elements to srcML base code. See templates documentation (especially the root template) for a more detailed description.
CVS Id:
axc.xsl 138 2005-07-27 09:14:07Z ibirrer
Author:
ibirrer
Copyright:
2005, P&P Software GmbH

Match Templates Summary

Main Root template
/ (mode: compiler) - source
Builds the general structure of the locator stylesheet.
* (mode: pointcutXPath) - source
If an unsupported element is encountered, the program aborts and outputs an errror message
ax:and (mode: pointcutXPath) - source
Template rule for and
ax:description | text() (mode: pointcutXPath) - source
Empty template to exclude description and text elements from the XPath creation for pointcuts
ax:not (mode: pointcutXPath) - source
Template rule for not
ax:or (mode: pointcutXPath) - source
Template rule for or
element: ax:pointcut parent: none constraint: yes (not empty)
element: ax:pointcut parent: yes constraint: yes (not empty)
A reference to a pointcut is resolved to the corresponding pointcut
A reference to a pointcut is resolved to the corresponding pointcut
* (mode: replaceDollarVariables) - source
Standard template for replacing dollar variables
ax:description (mode: replaceDollarVariables) - source
Removing description elements completely
ax:text/text() (mode: replaceDollarVariables) - source
Replaces variables used in codeModifiers (format: ${VariableName})with the <xsl:value-of .../> equivalent.
ax:xsl (mode: replaceDollarVariables) - source
Removing xsl elements
* (mode: resolveIncludes) - source
Default copy template to resolve Includes in aspects
ax:include (mode: resolveIncludes) - source
Resolve includes
Add apspect attribute to named pointcut elements and pointcutRef elements
node() (mode: variableDeclarations) - source
Do not do anything, as there are maybe no variable declaration for a particular srcML element

Match Templates Detail

Main Root template
Resolves any includes and hands the resulting file to the templates with mode compiler. Resolving includes is done by templates with mode resolveIncludes.
/ (mode: compiler) - source
Builds the general structure of the locator stylesheet.
Procedure:
  • 1. Find all anonymous pointcut and pointcutRef elements used for advices. These are all pointcut and pointcutRef elements definded as a direct child of an advice. Descendants of these are not inlcuded, neither are named pointcuts.
  • 2. Group the elements found by the type attribute. This means that a group consists of pointcut or pointcutRef elements which have the same value for the type attribute. Then iterate through the groups (Each group is processed once).
    • 2.1 Build an unnamed template for each group. The match attribute value is set to the common type attribute value of the group.
    • 2.2 Iterate through all distinct pointcutRef (a pointcutRef element is equal with another if their ref attribute value is equal) elements and all pointcut elements in the group.
      • 2.2.1 Build an if statement for each group
      • 2.2.2 Generate the XPath expression from the pointcut (Using the first pointcut in the group). This uses templates with mode pointcutXPath. PoinctutRef elements are translated to their corresponding pointcut element in a template with mode pointcutXPath.
      • 2.2.3 Find all advices which use any of the pointcuts or pointcutRef's in the group and copy them. (These are the advices which are direct parents of a pointcut or pointcutRef)
A pointcut type always directly refers to a specific srcML element. Therefore a template generated for a pointuct of type src:class, is processed for each src:class element in the srcML base code. Because all src:class elements are processed by this template the template logic needs to decide if an advice should be added to a specific src:class element. This is achieved by generating several xsl:if clauses inside the template. Each xsl:if tests if a pointcut matches the srcML element currently processed. Note that xsl:choose would not work for this purpose as it would only allow one pointcut to match one srcML element but of course there can be several pointcuts that match one srcML element (=pointcut type). Generating the test attribute of the xsl:if clause is done by several templates with the mode pointcutXPath (See also stylesheets in compilerRules/restrictions).
* (mode: pointcutXPath) - source
If an unsupported element is encountered, the program aborts and outputs an errror message
ax:and (mode: pointcutXPath) - source
Template rule for and
 
ax:description | text() (mode: pointcutXPath) - source
Empty template to exclude description and text elements from the XPath creation for pointcuts
 
ax:not (mode: pointcutXPath) - source
Template rule for not
 
ax:or (mode: pointcutXPath) - source
Template rule for or
 
element: ax:pointcut parent: none constraint: yes (not empty)
 
element: ax:pointcut parent: yes constraint: yes (not empty)
 
A reference to a pointcut is resolved to the corresponding pointcut
This pointcut is then again applied to the templates taking a pointcut to generate the XPath expression.
A reference to a pointcut is resolved to the corresponding pointcut
This pointcut is then again applied to the templates taking a pointcut to generate the XPath expression. In this case the parent element is a restriction and therefore the type of the pointcut needs to be output.
* (mode: replaceDollarVariables) - source
Standard template for replacing dollar variables
ax:description (mode: replaceDollarVariables) - source
Removing description elements completely
 
ax:text/text() (mode: replaceDollarVariables) - source
Replaces variables used in codeModifiers (format: ${VariableName})with the <xsl:value-of .../> equivalent.
This template uses regular expression of XSLT 2.0. Using <![[CDATA[ sections makes it possible to generate new xsl elements. If a dollarVariable is written in the form ${ var}, the space between the opening curly brace and the closing curly brace is added to variable as indentation. This is especially useful for the dollar variables $functionBody in an 'around' advice.
ax:xsl (mode: replaceDollarVariables) - source
Removing xsl elements
children of xsl elements are processed further.
* (mode: resolveIncludes) - source
Default copy template to resolve Includes in aspects
ax:include (mode: resolveIncludes) - source
Resolve includes
Replaces include elements by all contents (pointcuts, advices) of the aspect it refers to.
Add apspect attribute to named pointcut elements and pointcutRef elements
If an aspect attribute already exists it is not replaces.
node() (mode: variableDeclarations) - source
Do not do anything, as there are maybe no variable declaration for a particular srcML element