If the name attribute of an <xsl:element> or
<xsl:attribute> is dynamically allocated, e.g. via an
attribute value template within a named template, the
initial value which is calculated for the name is used
throughout the result, e.g.:
<xsl:template name="make-element">
<xsl:param name="element-name"/>
<xsl:element name="{$element-name}">
<xsl:attribute name="{$element-name}">
<xsl:value-of select="$element-name"/>
</xsl:attribute>
<xsl:value-of select="concat('This element is called
', $element-name)"/>
</xsl:element>
</xsl:template>
<xsl:template match="DESCRIPTION">
<Description>
<xsl:apply-templates/>
</Description>
</xsl:template>
<xsl:template match="PART.ASPECT.DESC">
<xsl:call-template name="make-element">
<xsl:with-param name="element-name" select="'First'"/>
</xsl:call-template>
<xsl:call-template name="make-element">
<xsl:with-param name="element-name" select="'Second'"/>
</xsl:call-template>
<xsl:call-template name="make-element">
<xsl:with-param name="element-name" select="'Third'"/>
</xsl:call-template>
</xsl:template>
This is because the FName property is calculated in the
Valid method, rather than within Execute. A simple
work-around is to re-evaluate the XpsName property
within the Execute method:
sName := EvaluateAttrib(oContext,
GetAttribute(XpsName)); {!!.60 rbl start}
sNamespace := EvaluateAttrib(oContext,
GetAttribute(XpsNamespace));