SlideShare a Scribd company logo
XML to XML transformation in Mule
Feroz Khan
As we know, there can be multiple types of payload we need to deal
daily, starting from JSON, XML or String, we also require different
type of data transformation in our application like XML to JSON,
JSON to XML or String etc . In Mule application, we have a various
set of transformers that we can use to obtain our required data
format.
Here we will be discussing on transformation of XML to XML format
of data. If you have gone through my previous slides on JSON to
JSON transformation here , you will realize how easy it is to perform
such type of transformation in Mule. Here we will take the same
example, but will be doing it on XML instead of JSON this time.
So, let us consider, we have the following XML payload as an input
to our application :-
<RootTag>
<name>Anirban Sen Chowdhary</name>
<id>37</id>
</RootTag>
.
We can see here the XML contains only 2 elements, that is name
and id.
So, now if this XML data is coming as an input and we require to
transform/modify the payload into anotherXML format and produce
it as an output, something like the following :-
<RootTag>
<name>Anirban Sen Chowdhary</name>
<id>37</id>
<designation>Director</designation>
</RootTag>
And here you can see the modified XML has a new element
designation as a third element . Now, the challenge here is to modify
the existing input XML payload and to design an output XML
payload from it, which will contain this additional element in it with
the same format.
So, how can we transform/modify the payload into another XML
format in an easy way. We know Mule has extremely powerful tools
called Datamapper but that limited to Mule enterprise edition.
How to transformor modifya XMLpayloadin
Mule ??
Asimple way of doing it is using XSLT in Mule. Mule do have XSLT
support in it’s flow, which makes the life of a developer easy in
transforming/modifying XML in the required format.
So, here is the Mule flow which can be use to transform XML payload
from one format to another using XSLT :-
After that, we are setting the designation variable with a value, which will
be passed into our XSLT, and it will be adding it there as a node called
designation. So, the XML output coming after XSLT will be the
modified/transformed XML containing additional node called designation.
The XSL file here named as Transform.xsl should be kept under
src/main/resources folder and the xsl file will be as following :-
The graphical representation of this flow will be as follows :-
Testing our application……
Now, we are done with our coding and will deploy our application and test it.
Once deployed on Mule server, we can test our application using RestClient
or any other client you wish.
once we click the send button we will get the following response in our client
from our Mule flow :-
Conclusion
So, you can find transforming or modifying aXMLpayload into another XML
format is extremely easy in Mule using theXSLT.
And that means you can design your outputXMLpayload in any format you
require using XSLT easily in your Mule flow and Mule also support this by
it’s XSLT transformer !!!
That’s all !!! I’ve hopefully been clear enough in displaying the
implementation of XSLT and XSLT transformer in designing and modifying
your XMLpayload which you can produce as an output from your Mule
application.
I hope you liked this !!!
Hope you enjoyed the simple yet an amazing trick in Mule
You can also find this post here :- http://bushorn.com/xml-to-xml-
transformation-in-mule/
Xml to xml transformation in mule

More Related Content

What's hot (14)

PPTX
Xslt in mule
irfan1008
 
PPTX
Xslt in mule
Mohammed246
 
PPTX
Scatter and gather in mule
Rajkattamuri
 
PPTX
xslt in mule
Praneethchampion
 
PPTX
Mule velocity
Praneethchampion
 
PPTX
Mule quartz
Praneethchampion
 
PPTX
Idempotent filter in Mule
F K
 
PPTX
Deploying and Running in Mule
Khasim Saheb
 
PPTX
Running mule standalone
Son Nguyen
 
PPTX
Mule message enricher
Anirban Sen Chowdhary
 
PPTX
Accessing jms in mule using groovy
Anirban Sen Chowdhary
 
PPTX
Stored procedure in Mule
Khasim Saheb
 
PPTX
Mulesoft http connector
kumar gaurav
 
PPTX
Mule soap
D.Rajesh Kumar
 
Xslt in mule
irfan1008
 
Xslt in mule
Mohammed246
 
Scatter and gather in mule
Rajkattamuri
 
xslt in mule
Praneethchampion
 
Mule velocity
Praneethchampion
 
Mule quartz
Praneethchampion
 
Idempotent filter in Mule
F K
 
Deploying and Running in Mule
Khasim Saheb
 
Running mule standalone
Son Nguyen
 
Mule message enricher
Anirban Sen Chowdhary
 
Accessing jms in mule using groovy
Anirban Sen Chowdhary
 
Stored procedure in Mule
Khasim Saheb
 
Mulesoft http connector
kumar gaurav
 
Mule soap
D.Rajesh Kumar
 

Similar to Xml to xml transformation in mule (20)

PPTX
Xml to xml transformation in mule
javeed_mhd
 
PPTX
Xml to xml transformation in mule
Mohammed625
 
PPTX
Xml transform
Son Nguyen
 
PPTX
Xml to xml transformation in mule
Davide Rapacciuolo
 
PPTX
Xml to xml transformation in mule
Germano Barba
 
PPTX
Xml to xml transformation in mule
Davide Rapacciuolo
 
PPTX
Xml to xml transformation
Son Nguyen
 
PPTX
Xml to xml transformation in mule
Domenico Schiavone
 
PPTX
Using XSLT in Mule
Anirban Sen Chowdhary
 
PPTX
Xslt with mule
Son Nguyen
 
PPTX
Xslt in mule
Sunil Komarapu
 
PPTX
Xslt in mule
Shahid Shaik
 
PPTX
Xslt in mule
Hasan Syed
 
PPTX
Using xslt in mule
Khan625
 
PPTX
Using xslt in mule
mdfkhan625
 
PPTX
Using xslt in mule
javeed_mhd
 
PPTX
Using xslt in mule
Rajkattamuri
 
PPTX
Using xslt in mule
AbdulImrankhan7
 
PPTX
Converting with custom transformer
irfan1008
 
PPTX
Converting with custom transformer
Hasan Syed
 
Xml to xml transformation in mule
javeed_mhd
 
Xml to xml transformation in mule
Mohammed625
 
Xml transform
Son Nguyen
 
Xml to xml transformation in mule
Davide Rapacciuolo
 
Xml to xml transformation in mule
Germano Barba
 
Xml to xml transformation in mule
Davide Rapacciuolo
 
Xml to xml transformation
Son Nguyen
 
Xml to xml transformation in mule
Domenico Schiavone
 
Using XSLT in Mule
Anirban Sen Chowdhary
 
Xslt with mule
Son Nguyen
 
Xslt in mule
Sunil Komarapu
 
Xslt in mule
Shahid Shaik
 
Xslt in mule
Hasan Syed
 
Using xslt in mule
Khan625
 
Using xslt in mule
mdfkhan625
 
Using xslt in mule
javeed_mhd
 
Using xslt in mule
Rajkattamuri
 
Using xslt in mule
AbdulImrankhan7
 
Converting with custom transformer
irfan1008
 
Converting with custom transformer
Hasan Syed
 
Ad

More from mdfkhan625 (20)

PPTX
Mapping and listing with mule
mdfkhan625
 
PPTX
How to use message properties component
mdfkhan625
 
PPTX
How to use expression filter
mdfkhan625
 
PPTX
Data weave
mdfkhan625
 
PPT
Anypoint data gateway
mdfkhan625
 
PPTX
Webservice with vm in mule
mdfkhan625
 
PPTX
Validating soap request in mule
mdfkhan625
 
PPTX
Groovy example in mule
mdfkhan625
 
PPTX
Scatter gather flow control
mdfkhan625
 
PPTX
Mule with velocity
mdfkhan625
 
PPTX
Mule with rabbit mq
mdfkhan625
 
PPTX
Mule with quartz
mdfkhan625
 
PPTX
Mule with drools
mdfkhan625
 
PPTX
Mule esb
mdfkhan625
 
PPTX
Idempotent filter with simple file
mdfkhan625
 
PPTX
Creating dynamic json
mdfkhan625
 
PPTX
Converting with custom transformer
mdfkhan625
 
PPTX
Caching and invalidating with managed store
mdfkhan625
 
PPTX
Cache for community edition
mdfkhan625
 
PPTX
Automatic documantation with mule
mdfkhan625
 
Mapping and listing with mule
mdfkhan625
 
How to use message properties component
mdfkhan625
 
How to use expression filter
mdfkhan625
 
Data weave
mdfkhan625
 
Anypoint data gateway
mdfkhan625
 
Webservice with vm in mule
mdfkhan625
 
Validating soap request in mule
mdfkhan625
 
Groovy example in mule
mdfkhan625
 
Scatter gather flow control
mdfkhan625
 
Mule with velocity
mdfkhan625
 
Mule with rabbit mq
mdfkhan625
 
Mule with quartz
mdfkhan625
 
Mule with drools
mdfkhan625
 
Mule esb
mdfkhan625
 
Idempotent filter with simple file
mdfkhan625
 
Creating dynamic json
mdfkhan625
 
Converting with custom transformer
mdfkhan625
 
Caching and invalidating with managed store
mdfkhan625
 
Cache for community edition
mdfkhan625
 
Automatic documantation with mule
mdfkhan625
 
Ad

Recently uploaded (20)

PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
July Patch Tuesday
Ivanti
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 

Xml to xml transformation in mule

  • 1. XML to XML transformation in Mule Feroz Khan
  • 2. As we know, there can be multiple types of payload we need to deal daily, starting from JSON, XML or String, we also require different type of data transformation in our application like XML to JSON, JSON to XML or String etc . In Mule application, we have a various set of transformers that we can use to obtain our required data format. Here we will be discussing on transformation of XML to XML format of data. If you have gone through my previous slides on JSON to JSON transformation here , you will realize how easy it is to perform such type of transformation in Mule. Here we will take the same example, but will be doing it on XML instead of JSON this time.
  • 3. So, let us consider, we have the following XML payload as an input to our application :- <RootTag> <name>Anirban Sen Chowdhary</name> <id>37</id> </RootTag> .
  • 4. We can see here the XML contains only 2 elements, that is name and id. So, now if this XML data is coming as an input and we require to transform/modify the payload into anotherXML format and produce it as an output, something like the following :- <RootTag> <name>Anirban Sen Chowdhary</name> <id>37</id> <designation>Director</designation> </RootTag>
  • 5. And here you can see the modified XML has a new element designation as a third element . Now, the challenge here is to modify the existing input XML payload and to design an output XML payload from it, which will contain this additional element in it with the same format. So, how can we transform/modify the payload into another XML format in an easy way. We know Mule has extremely powerful tools called Datamapper but that limited to Mule enterprise edition.
  • 6. How to transformor modifya XMLpayloadin Mule ??
  • 7. Asimple way of doing it is using XSLT in Mule. Mule do have XSLT support in it’s flow, which makes the life of a developer easy in transforming/modifying XML in the required format. So, here is the Mule flow which can be use to transform XML payload from one format to another using XSLT :-
  • 8. After that, we are setting the designation variable with a value, which will be passed into our XSLT, and it will be adding it there as a node called designation. So, the XML output coming after XSLT will be the modified/transformed XML containing additional node called designation. The XSL file here named as Transform.xsl should be kept under src/main/resources folder and the xsl file will be as following :-
  • 9. The graphical representation of this flow will be as follows :-
  • 11. Now, we are done with our coding and will deploy our application and test it. Once deployed on Mule server, we can test our application using RestClient or any other client you wish.
  • 12. once we click the send button we will get the following response in our client from our Mule flow :-
  • 14. So, you can find transforming or modifying aXMLpayload into another XML format is extremely easy in Mule using theXSLT. And that means you can design your outputXMLpayload in any format you require using XSLT easily in your Mule flow and Mule also support this by it’s XSLT transformer !!! That’s all !!! I’ve hopefully been clear enough in displaying the implementation of XSLT and XSLT transformer in designing and modifying your XMLpayload which you can produce as an output from your Mule application. I hope you liked this !!!
  • 15. Hope you enjoyed the simple yet an amazing trick in Mule You can also find this post here :- http://bushorn.com/xml-to-xml- transformation-in-mule/