Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<TEST ID="1" DATA="DATE"/>
<TEST/>
<TEST2 ID="3" COLUMN="VALUE"/>
</dataset>
Desired Output:
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<TEST ID="1" DATA="DATE"/>
<TEST2 ID="3" COLUMN="VALUE"/>
</dataset>
Current applied XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*[not(child::node())]"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Current Output:
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
</dataset>
What could be the condition to be applied, to achieve output without empty '<TEST/>' node in result.