Voici une solution possible
Mais il reste un probleme a resoudre, les attributs
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:user="userhtml">
<xsl:output method="xml"/>
<xsl:variable name="CR" select="string('
'
"/>
<xsl:template match="*">
<xsl:value-of select="$CR"/>
<xsl:choose>
<xsl:when test="count(*|text()[string-length(normalize-space(.))>0])">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
<xsl:value-of select="$CR"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>