Link Search Menu Expand Document

XSLT Cheat Sheet

Output mode

<xsl:output method="xml" version="1.0"/>
<xsl:output omit-xml-declaration="yes" indent="yes"/>

Drop all empty nodes

Use this copy template

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>     

together with this stripping template:

<xsl:template match="*[. = '']"/>

or a more exact one to account for attributes

<xsl:template match="*[not(@*) and not(*) and (not(text())]"/>

See also: Stackoverflow

XML Gettext Translation

Check out the XSLT translation stylesheet used in Liferea