Thank you so much!!! I had been wrestling with the problem for a while.
However I'm not sure why I couldn't use the last part of your code as you wrote it:
Code:
<!-- discripted the node which found in element2 -->
<xsl:template match="leaf3">
<xsl:text> <leaf3></xsl:text>
<xsl:value-of select="."/>
<xsl:text><leaf3> </xsl:text>
</xsl:template>
<xsl:template match="leaf5">
<xsl:text> <leaf5></xsl:text>
<xsl:value-of select="."/>
<xsl:text><leaf5> </xsl:text>
</xsl:template>
...
I was getting parsing errors that for instance </text> is expected before <leaf3> (in the third line). I tried using disable-output-escaping as well but all the same.
So I finally ended up using <![CDATA...]]> which works fine.
The rest of the code worls like a charm! Now I have to google-read your code to understand some parts (as I said, I'm new to XSLT).
Thanks to you, my problem is solved now

however I'm trying to understand the logic here so I would appreciate any clarification on the following three points:
First, any idea why I couldn't use <xsl:text>?
Second, let's say for instance leaft3 has some attributes. Is it possible to include its attributes as well so we get this:
<element leaf1="whatever" leaf2="whatever" element2="data<leaf3 id="ID">data</leaf3>data">
</element>
I guess we probably have to use some sort of espace characters here to avoid the conflict between " characters, right?
Third, is there any way not to include the description found in e2? So to omit the data in
<!-- discripted the node which found in element2 -->
in the code? So I guess I'm asking if there is a way to use a variable instead of "leaf3" in:
<!-- discripted the node which found in element2 -->
<xsl:template match="leaf3">
<xsl:text> <leaf3></xsl:text>
<xsl:value-of select="."/>
<xsl:text><leaf3> </xsl:text>
</xsl:template>
...
...
We possibly can (I guess) but I'm not very familiar with the syntax of XSLT.
As I said, these three points are extra. You solved my problem however I would like to have some more insight.
Thanks again!

F