I'd like to concatenate recursively the parameter value of a node with the value of the same parameter of its parent node.
Example, the following:
<node name="root">
<node name="A">
<node name="B">
<node name="C">
<value1>12</value1>
<value2>36</value1>
</node>
</node>
</node>
</node>
Should become
<node name="root">
<node name="root.A">
<node name="root.A.B">
<node name="root.A.B.C">
<value1>12</value1>
<value2>36</value1>
</node>
</node>
</node>
</node>
I tried with
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="node/@name">
<xsl:choose>
<xsl:when test=". = 'root'">
<xsl:attribute name="name"><xsl:text>webshop</xsl:text></xsl:attribute>
</xsl:when>
<xsl:when test="not(. = 'root')">
<xsl:attribute name="name"><xsl:value-of select="../../@name"/>.<xsl:value-of select="../@name"/></xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
But the result is not the one expected. What I get is
<node name="root">
<node name="root.A">
<node name="A.B">
<node name="B.C">
<value1>12</value1>
<value2>36</value1>
</node>
</node>
</node>
</node>
What's the problem?