Don't try to create markup by hand. Create element nodes (using xsl:element for example) and let the serializer do the markup for you.
You've sort-of reinvented the important concept of the identity template by yourself, congratulations. I usually write it as:
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
which I suspect will meet your needs better.
Doing
<xsl:apply-templates select="*"/>
<xsl:value-of select="text()"/>
seems a bad idea as it will process all the child elements, then all the child text nodes, which loses the order if elements and text nodes are mixed together. Doing <xsl:apply-templates select="node()"/> (which is the default with no select) does the same thing but retains the order.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference