I found a similar question here:
How to read attribute of a parent node from a child node in XSLT
But not exactly what I need here. Suppose using the same example here:
<A>
<b attr1="xx">
<c>
Turn this into an Attribute
</c>
</b>
</A>
and I want the resulting xml after xslt looks like:
<A>
<b attr1="xx" cAttr="Turn this into an Attribute">
</b>
</A>
Using my current knowledge, I could only manage to get rid of the node or change its name to the desired name "cAttr", but I really have no idea of how to turn the whole node into an attribute of the parent node, by only knowing how to refer to attribute field of the parent node won't help me a lot here.
My current code just looks like this:
<xsl:template match="c">
<xsl:element name="cAttr">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
Thanks in advance.