Skip to Content
Oct 13, 2019 at 09:24 AM

Remove specific null field from source XML payload via XSLT or Groovy

284 Views Last edit Oct 14, 2019 at 12:27 PM 4 rev

Hello Experts,

We need to remove specific null fields from source Xml through XSLT code before message mapping.

For example,

if <BankDetails__c><BankDetails__c/> and <Contacts__c><Contacts__c/> fields, then remove these BankDetails__c and Contacts__c fields in source payload and pass remaining fields.

Below is the sample payload:

<?xml version="1.0" encoding="UTF-8"?> <snotification> <data> <schema>jk6ABmagsb8NCfdjbn</schema> <payload> <ACC_KUNNR__c>20795777</ACC_KUNNR__c> <SAI_WBRSL__c/> <ACC_ZZ_PNUMBER__c/> <BankDetails__c><BankDetails__c/> <Contacts__c><Contacts__c/> <CreditInfomation__c>12345</CreditInfomation__c> </payload> </data> </snotification>

Please help me out.