pros,
I need to convert the ‘B’ tag with ‘X’ tag in the following document:
<a>
<B marker="true">
<c>
<B marker="true">
<d>
<B marker="true">
</B>
<d>
</B>
</c>
</B>
</a>
Note the reoccurring ‘B’, it can appear at any depth in dynamic XML.
Here’s what I did:
<xsl:template match="//*[@marker='true']">
<X>
<xsl:copy-of select="./node()"/>
</X>
</xsl:template>
It worked for the top-most ‘B’ tag, but ignored all the nested ones.
I think I know what the problem is – ‘copy-of’ just flushes the content of the top-most ‘B’ tag, without evaluating it. What can I do to make ‘copy-of’ reevaluate my template?
Thanks!
Baruch.
I would go with identity transform.
This code:
Against this XML input:
Will provide this correct result: