The above solution is working fine, but it doesn't leave place for manipulating the output by adding other HTML tags. Because for example I need to put, for the child elements, <a> and <img>.
Here is what I ended up with:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template match="*[*]">
<li>
<xsl:value-of select="local-name()" />
<ul>
<xsl:apply-templates />
</ul>
</li>
</xsl:template>
<xsl:template match="*[not(*)]">
<li>
<xsl:value-of select="local-name()" />
</li>
</xsl:template>
<xsl:template match="/*" priority="5">
<ul>
<xsl:apply-templates />
</ul>
</xsl:template>
</xsl:stylesheet>