Skip to Content

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

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 17, 2019 at 08:05 AM

    google search or search in stackoverflow about xslt questions. dont search in sap community.

    https://stackoverflow.com/questions/6648679/removing-empty-tags-from-xml-via-xslt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.