Using XSLT to Remove Empty Node from request.
· To implement this, we simply create one additional step in process/orchestration.
· Add new map with Source schema same as destination schema.
· Use the following custom XSLT code to scan the request and remove all empty node.
Map with same schema as request and response.
Use the following xslt file with your schema namespace.
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="-- YOUR NAMESPACE --" version="1.0" xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" indent="yes" />
<xsl:template match="node()">
<xsl:if test="count(descendant::text()[string-length(normalize-space(.))>0]|@*)">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="@*">
<xsl:copy />
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)" />
</xsl:template>
</xsl:stylesheet>
Thank You !It worked
ReplyDelete