Assuming you don't have any mixed content in your document, you can do the conversion using:
<xsl:template match="*[text()]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="dummy">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(text())]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference