Wednesday, December 22, 2021

Remove the root node from XML using XSLT mapping.



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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ser-root1="http://test.com/xi/SAP/city"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
 
<xsl:template match="/ServiceCRM">
     
<xsl:copy-of select="*" />   
 
</xsl:template>
 
</xsl:stylesheet>

(or)

We can use filter palette and remove root node.


Example:











Input:

<ServiceCRM>
  <Obj>
    <straction>ABC</straction>
    <stractivedate>Orange</stractivedate>
    <stractivestatus>Completed</stractivestatus>
  </Obj>
</ServiceCRM>

Output:

 <Obj>
    <straction>ABC</straction>
    <stractivedate>Orange</stractivedate>
    <stractivestatus>Completed</stractivestatus>
  </Obj>


No comments:

Post a Comment

The sender will pass the data in JSON format without converting it to XML format. We need to read the particular field.

The sender will pass the data in JSON format without converting it to XML format. We need to read the particular field to check the conditio...