on 01-20-2018 7:44 AM
Hi Experts,
I have a requirement to delete the root node and convert into Json format through XSLT mapping.
I have to remove this tag <ns0:MT_CSV_City_CONTACT>
and need to convert the entire structure into Json format.
Structure:
<?xml version="1.0" encoding="UTF-8" ?> <ns0:MT_CSV_City_CONTACT xmlns:ns0="http://test.com/xi/SAP/city"> <Timestamp>/Date(1516432826000)/</Timestamp> <UserName>S_PI</UserName> <SourceSystemType>EXT</SourceSystemType> <SourceSystemId>CSV_Source</SourceSystemId> <Contacts> <Id>test@email.com</Id> <IdOrigin>ZCITY</IdOrigin> <FirstName>ram</FirstName> <LastName>test</LastName> <LanguageDescription>DE</LanguageDescription> <CountryDescription>India</CountryDescription> <Facets> <Id>test@email.com</Id> <IdOrigin>SITY</IdOrigin> </Facets> <MarketingPermissions> <Id>test@email.com</Id> <IdOrigin>EMAIL</IdOrigin> <OptIn>Y</OptIn> <OutboundCommunicationMedium>EMAIL</OutboundCommunicationMedium> <CommunicationDirection>O</CommunicationDirection> <CommunicationCategoryId>0000000037</CommunicationCategoryId> </MarketingPermissions> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>a</Value> </MarketingAttributes> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>i</Value> </MarketingAttributes> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>k</Value> </MarketingAttributes> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>m</Value> </MarketingAttributes> </Contacts> <Contacts> <Id>rr@gmail.com</Id> <IdOrigin>ZSITY</IdOrigin> <FirstName>ram</FirstName> <LastName>surya</LastName> <CountryDescription>DE</CountryDescription> <Facets> <Id>rr@gmail.com</Id> <IdOrigin>ZSITY</IdOrigin> </Facets> <MarketingPermissions> <Id>rr@gmail.com</Id> <IdOrigin>EMAIL</IdOrigin> <OptIn>Y</OptIn> <OutboundCommunicationMedium>EMAIL</OutboundCommunicationMedium> <CommunicationDirection>O</CommunicationDirection> <CommunicationCategoryId>0000000037</CommunicationCategoryId> </MarketingPermissions> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>a</Value> </MarketingAttributes> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>e</Value> </MarketingAttributes> <MarketingAttributes> <CategoryDescription>MC</CategoryDescription> <Value>k</Value> </MarketingAttributes> </Contacts> </ns0:MT_CSV_City_CONTACT>
Can anybody please help in this.
Hi ,
Use below code
<?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="/ser-root1:MT_CSV_City_CONTACT"> <xsl:copy-of select="*" /> </xsl:template></xsl:stylesheet>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiva,
Thank you for the code, we have successfully implemented requirement with the help of your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.