Filter the unused Tags from the mapping XML

Situation: Remove all the blank\unused tag from a mapping output

Solution: Use an intermediary mapping

Steps to filter the unused Tags from the mapping XML

  • Create a dummy mapping and load any schema at source and target.
  • Save that mapping.
  • Replace the existing XSL code with the following XSL code in mapping Advanced properties. Please refer the to the following screen where you need to replace the XSL.

Note: Please add the first line in XSL code that indicates the version of xml according to the version of xml that you are using, Ex.(<?xml version='1.0'?>).

Code:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <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(@*) and not(*) and (not(text()) or .=-1)]"/>
</xsl:stylesheet>

  • Save that mapping.
  • Apply this mapping in the process flow between the first and second mapping.

  • Save the process flow and execute the flow. This will remove all the unused\blank tags from the first mapping output xml.

 

Note: Please do not save this dummy mapping through graphical mode.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.