<
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 an initializer to an initializer list of a constructor.</
xd:
short>
<
xd:
detail>
<
ul>
<
li>
srcML element: <
code>
src:member_list</
code></
li>
<
li>
advice type: <
code>
add</
code></
li>
<
li>
codeModifier type: <
code>
initializer</
code></
li>
</
ul>
<
p>
This template is used as by <
a href="
constructor_add_initializer.xsl.xd.html">
constructor_add_initializer.xsl</
a>
.
It is not intended to use directly from an aspect.</
p>
<
xd:
weaverRuleLinks pointcutType="
src:member_list"
adviceType="
add"
codeModifierType="
initializer" />
</
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>
Adds an initializer to a member list
</
xd:
doc>
<
xsl:
template match="
src:member_list[ax:advice[@type='add' and position() = 1]/ax:codeModifier[@type='initializer']]"
mode="
weaving">
<!---->
<
xsl:
variable name="
advice"
select="
ax:advice[1]" />
<!---->
<
xsl:
copy>
<
xsl:
copy-of select="
@*" />
<!---->
<
xsl:
copy-of select="
ax:advice[position() != 1]" />
<!---->
<
xsl:
apply-templates mode="
weaving" />
<!---->
<
ax:
inserted>
<
xsl:
variable name="
initializers">
<!---->
<
xsl:
if test="
count(*[not(self::ax:advice)]) != 0">
<
xsl:
text>
, </
xsl:
text>
</
xsl:
if>
<
xsl:
for-each select="
$advice/ax:codeModifier">
<
xsl:
for-each select="
ax:text">
<
xsl:
value-of select="
." />
<
xsl:
if test="
position() != last()">
<
xsl:
text>
</
xsl:
text>
</
xsl:
if>
</
xsl:
for-each>
<
xsl:
if test="
position() != last()">
<
xsl:
text>
, </
xsl:
text>
</
xsl:
if>
</
xsl:
for-each>
</
xsl:
variable>
<
xsl:
value-of select="
string-join($initializers,'')" />
</
ax:
inserted>
</
xsl:
copy>
</
xsl:
template>
</
xsl:
stylesheet>
v