I try to delete empty nodes, but not all of them, for example I have tags:
1.<abc></abc> - it should be delete
2.<cde/> - it should not be delete.
3.<fgh/> - it SHOULD be delete.
So, i would like to delete empty nodes in point 2 (explicit name "CDE")
So in other words: when tag like 'cde' and tag is null then delete. : D
Is it possible?
I found the code which delete all the empty nodes:
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*[descendant::text() or descendant-or-self::*/@*[string()]]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*[string()]">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
EDIT:
XML look like:
<system/>
<smth></smth>
<smth2>?</smth2>
<smth3>?</smth3>
<smth4></smth4>
<smth4></smth4>
<smth5/>
XML can contain a lot of tags like - SO i have remove them dynamically. Some of tags which looks like I WANT to remove. But in this XML should stay.
So XML output should looks:
<system/>
<smth2>?</smth2>
<smth3>?</smth3>
I found the solution: http://xsltransform.net/nc4NzRx/3. : )