tag remove log from XML output

Hi,I need some help.

I have input XML…depend on the logic output xml will be generated.

based on condition while mapping under LOOP. We do not want some tag in output xml.

but I am getting empty tag in output. (line 3 and 4 are empty tags)

<?xml version="1.0"?> Mr. C Mexciko 10000 PM

in the documentToXMLString step I,set “generateRequiredTags=false” and give document name in ‘documentTypeName’ field.

Still empty tags are coming…

Could you please suggest how to remove those empty tag.’

Thanks,
Nabanita

Hi Nabanita,

can you provide an outline of your transformation logic please?

Assuming Emp is a list, where is not clear which ones and how many of the entries are empty you should do the following:

Loop over the list Emp and only map the entries if “Emp is not empty” via BRANCH.

Regards,
Holger

try to create a xslt service with this, it will filter empty nodes for you:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version=“2.0” xmlns:xsl=“XSLT Namespace”>
<xsl:output method=“xml”/>
<xsl:template match=“/”>
<xsl:apply-templates select=““/>
</xsl:template>
<xsl:template match=”
”>
<xsl:if test=“.!=‘’”>
xsl:copy
<xsl:copy-of select=“@*”/>
xsl:apply-templates/
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Hi,

The document you are using to generate the output has those fields defined (even if empty) or set as null?

Are those fields set as required=true in the original document type?

I don’t know if there is a better way, but before converting to XML, you could use a BRANCH operation on that field and use a MAP operation to drop the field from the document if it’s empty (leave the label empty) or if it’s null (another operation whose label is set to $null).

Best Regards,

Many thanks