I am quite new to XSLT and find it very hard to understand properly..
I want to achieve that every element where my CDATA has no value should be removed from the XML.
My XML looks like this:
<description>
<internet>
<texts_short>
<text locale="de"><![CDATA[]]></text>
<text locale="en"><![CDATA[EXF/RETAIL]]></text>
<texts_long>
<text locale="de"><![CDATA[]]></text>
</texts_long>
</internet>
<vehicle>
<texts_short/>
<texts_long>
<text locale="en"><![CDATA[Backend Functions Bundle]]></text>
</texts_long>
<texts_text2speech>
<text locale="de"><![CDATA[]]></text>
</texts_text2speech>
</vehicle>
</description>
I have already prepared the following XSLT which removes every text element with no condition:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text"/>
</xsl:stylesheet>
How can I achieve that only the elements with empty CDATA value will be removed - so that only the one with text "EXF/RETAIL" and "Backend Functions Bundle" will stay?
Thank you in advance!