How to Delete empty fields/Tags from input xml?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018 02:17 AM
Hi Team,
I have a requirement to delete the fields which are empty. Can you please help me on this.
Thanks and Regards,
Gopi Bekkanti.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 07:06 AM
Hi GBekkanti,
You can use the following XSLT lines to remove all empty elements from XML:
<xsl:stylesheet version=“1.0” xmlns:xsl=“XSLT Namespace”>
<xsl:output omit-xml-declaration=“yes” indent=“yes”/>
<xsl:strip-space elements=“"/>
<xsl:template match="node()|@”>
<xsl:copy>
<xsl:apply-templates select=“node()|@“/>
</xsl:copy>
</xsl:template>
<xsl:template match=”[not(@||comment()|processing-instruction()) and normalize-space()=‘’]”/>
</xsl:stylesheet>
- Make file with .xslt extension, and copy paste the lines provided above.
- Drag XSLT snap and upload the .xslt file.
removeEmptyElements.txt (458 Bytes)
