<
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:xd="
http://www.pnp-software.com/XSLTdoc"
xmlns:ax="
http://control.ee.ethz.ch/XWeaver/AspectX"
version="
2.0">
<
xd:
doc type="
stylesheet">
<
xd:
short>
Weaving Rule that weaves a code fragment at the beginning of a constructor or destructor. </
xd:
short>
<
xd:
detail>
<
p>
The only thing this rule does is copying the advices to the <
code>
src:block</
code>
element.</
p>
<
ul>
<
li>
srcML element: <
code>
src:constructor, src:destructor</
code></
li>
<
li>
advice type: <
code>
begin</
code></
li>
<
li>
codeModifier type: <
code>
codeFragment</
code></
li>
</
ul>
<
h2>
Example</
h2>
<
p>
See <
a href="
function_begin_codeFragment.xsl.xd.html">
function_begin_codeFragment.xsl</
a>
.</
p>
<
xd:
weaverRuleLinks pointcutType="
src:constructor"
adviceType="
begin"
codeModifierType="
codeFragment" />
</
xd:
detail>
<
xd:
cvsId>
$Id$</
xd:
cvsId>
<
xd:
author>
ibirrer</
xd:
author>
<
xd:
copyright>
2004, P&P Software GmbH</
xd:
copyright>
</
xd:
doc>
<!---->
<
xsl:
preserve-space elements="
*" />
<
xd:
doc>
Apply tempates with mode <
code>
weaving_constructor_begin_codeFragment</
code>
to all (excludig advice elements) child elements.
</
xd:
doc>
<
xsl:
template match="
src:constructor[ax:advice[@type='begin' and position() = 1]/ax:codeModifier[@type='codeFragment']] | src:destructor [ax:advice[@type='begin' and position() = 1]/ax:codeModifier[@type='codeFragment']]"
mode="
weaving">
<
xsl:
copy>
<
xsl:
copy-of select="
@*" />
<!---->
<
xsl:
copy-of select="
ax:advice[@type!='begin' and ax:codeModifier/@type!='codeFragment']" />
<!---->
<
xsl:
apply-templates select="
node()[not(self::ax:advice)]"
mode="
weaving_constructor_begin_codeFragment">
<
xsl:
with-param name="
advices"
select="
ax:advice[@type = 'begin' and ax:codeModifier/@type = 'codeFragment']" />
</
xsl:
apply-templates>
</
xsl:
copy>
</
xsl:
template>
<
xd:
doc>
Template for the block.
<
xd:
param name="
advices"
type="
node-set">
Advices which should be copied to the src:block element.</
xd:
param>
</
xd:
doc>
<
xsl:
template match="
src:block"
mode="
weaving_constructor_begin_codeFragment">
<
xsl:
param name="
advices" />
<
xsl:
copy>
<
xsl:
copy-of select="
@*" />
<
xsl:
copy-of select="
$advices" />
<
xsl:
copy-of select="
child::node()" />
</
xsl:
copy>
</
xsl:
template>
<
xd:
doc>
Default copy template.
<
xd:
param name="
advices"
type="
node-set">
Advices which should be copied to the src:block element.</
xd:
param>
</
xd:
doc>
<
xsl:
template match="
*"
mode="
weaving_constructor_begin_codeFragment">
<
xsl:
param name="
advices" />
<
xsl:
copy>
<
xsl:
copy-of select="
@*" />
<
xsl:
apply-templates mode="
weaving_constructor_begin_codeFragment">
<
xsl:
with-param name="
advices"
select="
$advices" />
</
xsl:
apply-templates>
</
xsl:
copy>
</
xsl:
template>
</
xsl:
stylesheet>
v