SlideShare a Scribd company logo
Mule XSLT
We often use XSLT in our application to transform XML
payload from one form to another . Mule also supports XSLT
in it’s application with XSLT-Transformer component.
So, How can we use XSLT in Mule application??
.
Here I will show you how ……
Before we start we must see what an XSLT actually is :-
As per XSLT definition :-
XSLT (Extensible Stylesheet Language Transformations) is a language
for transforming XML documents into other XML documents, or other
formats such as HTML for web pages, plain text or into XSL Formatting
Objects, which may subsequently be converted to other formats, such
as PDF PostScript and PNG.
Source :- http://en.wikipedia.org/wiki/XSLT
So, XSLT can be use to transform one form of XML to another :-
Here you can see the XSLT is transforming the XML payload into another XML
So, let us try this example in our Mule application
Here we will be using XSLT for transforming the XML payload into another XML
like below :-
So let’s consider we have a following flow in our Mule application:-
As you can see we have used a Http inbound end point followed by a set payload
component and then XSLT transformer.
Here the set payload contain the XML that need to be transform
So set payload component contains the following payload :-
Our corresponding Mule flow will be as follows :-
<flow name="xsltFlow1" doc:name="xsltFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081"
path="test" doc:name="HTTP"/>
<set-payload
value="&lt;RootElement&gt;&lt;Name&gt;Anirban&lt;/Name&gt;&lt;Department&gt;ATS&lt;/D
epartment&gt;&lt;Designation&gt;SSE&lt;/Designation&gt;&lt;/RootElement&gt;"
doc:name="Set Payload"/>
<mulexml:xslt-transformer
maxIdleTransformers="2" maxActiveTransformers="5" outputEncoding="UTF-8"
doc:name="Transform from outer to inner" xsl-file="Transform.xslt"
encoding="UTF-8" returnClass="java.lang.String" />
</flow>
As you can see we are using XSLT file :- Transform.xslt
So, the file Transform.xslt
should be in our src/main/resource folder
The file Transform.xslt
Contains following code to transform :-
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<NewRootElement>
<NewName>
<xsl:value-of select="RootElement/Name" />
</NewName>
<NewDepartment>
<xsl:value-of select="RootElement/Department" />
</NewDepartment>
<NewDesignation>
<xsl:value-of select="RootElement/Designation" />
</NewDesignation>
</NewRootElement>
</xsl:template>
</xsl:stylesheet>
To test the application we hit the url http://localhost:8081/test in our
browser and we get the following :-
And you can see the XML payload has been transferred to this new XML
Hope you enjoyed the simple yet an amazing trick in Mule
Xslt in mule

More Related Content

What's hot (17)

PPTX
Mapping and listing in mule
Khan625
 
PPTX
Splitting with mule part2
Anirban Sen Chowdhary
 
PPTX
File component in mule demo
Sudha Ch
 
PPTX
Mule accessing multiple database in parallel
Anirban Sen Chowdhary
 
PPTX
Mule esb transformers
Mani Rathnam Gudi
 
PPTX
File component in mule
Rajkattamuri
 
PPT
Mule introduction
Satya Sekhar Das Mandal
 
PPTX
Using parse template component
Rahul Kumar
 
PPTX
Mule data weave_10
kunal vishe
 
PDF
MuleSoft ESB Message Enricher
akashdprajapati
 
PPTX
Mule data weave_2
kunal vishe
 
PPTX
For each component in mule
Rajkattamuri
 
PDF
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
Jitendra Bafna
 
PPTX
Mulesoft xml to Java Conversion
v srikanth
 
PPTX
Routing in mule
vasanthii9
 
PDF
Passing java arrays in oracle stored procedure from mule esb flow
Priyobroto Ghosh (Mule ESB Certified)
 
PPTX
Mule data weave_3
kunal vishe
 
Mapping and listing in mule
Khan625
 
Splitting with mule part2
Anirban Sen Chowdhary
 
File component in mule demo
Sudha Ch
 
Mule accessing multiple database in parallel
Anirban Sen Chowdhary
 
Mule esb transformers
Mani Rathnam Gudi
 
File component in mule
Rajkattamuri
 
Mule introduction
Satya Sekhar Das Mandal
 
Using parse template component
Rahul Kumar
 
Mule data weave_10
kunal vishe
 
MuleSoft ESB Message Enricher
akashdprajapati
 
Mule data weave_2
kunal vishe
 
For each component in mule
Rajkattamuri
 
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
Jitendra Bafna
 
Mulesoft xml to Java Conversion
v srikanth
 
Routing in mule
vasanthii9
 
Passing java arrays in oracle stored procedure from mule esb flow
Priyobroto Ghosh (Mule ESB Certified)
 
Mule data weave_3
kunal vishe
 

Viewers also liked (14)

PPTX
Examen trimestral dennis josue
josuecarias
 
PPTX
WSDL Services
Shahid Shaik
 
PPTX
WebServices Basic Introduction
Shahid Shaik
 
PDF
Socio-economic impact of boat-based whale watching in South Africa
ThisTourismWeek.co.za
 
PPTX
Jenkins
Shahid Shaik
 
PPTX
Dennis morales
josuecarias
 
PDF
ST International Catalog 2016
Zvi Halpert
 
PPTX
UDDI Services
Shahid Shaik
 
PDF
du-an-Jamona golen-silk-quan-7-sacomreal
thanhdiaoc1302 Thành
 
PPTX
..Earthquake Presentation by Jaspreet Suri....
Jaspreet Suri
 
PPTX
Java useful in Mule
Shahid Shaik
 
PPT
Maven introduction in Mule
Shahid Shaik
 
PPTX
Webservice vm in mule
Shahid Shaik
 
PPTX
Mule Webservices
Shahid Shaik
 
Examen trimestral dennis josue
josuecarias
 
WSDL Services
Shahid Shaik
 
WebServices Basic Introduction
Shahid Shaik
 
Socio-economic impact of boat-based whale watching in South Africa
ThisTourismWeek.co.za
 
Jenkins
Shahid Shaik
 
Dennis morales
josuecarias
 
ST International Catalog 2016
Zvi Halpert
 
UDDI Services
Shahid Shaik
 
du-an-Jamona golen-silk-quan-7-sacomreal
thanhdiaoc1302 Thành
 
..Earthquake Presentation by Jaspreet Suri....
Jaspreet Suri
 
Java useful in Mule
Shahid Shaik
 
Maven introduction in Mule
Shahid Shaik
 
Webservice vm in mule
Shahid Shaik
 
Mule Webservices
Shahid Shaik
 
Ad

Similar to Xslt in mule (20)

PPTX
Using xslt in mule
Khan625
 
PPTX
Using xslt in mule
javeed_mhd
 
PPTX
Using xslt in mule
Rajkattamuri
 
PPTX
Using xslt in mule
mdfkhan625
 
PPTX
Using xslt in mule
AbdulImrankhan7
 
PPTX
Mule xml transformation
D.Rajesh Kumar
 
PPTX
Xml to xml transformation in mule
javeed_mhd
 
PPTX
Xml to xml transformation in mule
Rajkattamuri
 
PPTX
Xml to xml transformation in mule
Mohammed625
 
PPTX
Xml transform
Son Nguyen
 
PPTX
Xml to xml transformation in mule
mdfkhan625
 
PPTX
Xml to xml transformation in mule
Domenico Schiavone
 
PPTX
Xml to xml transformation
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
Rest based api with xslt transformation
Nazia Abdullah
 
PPTX
Converting with custom transformer part 2
Anirban Sen Chowdhary
 
PPTX
Xslt mule
Sindhu VL
 
PDF
Mule esb and_relevant_components
Paaras Baru
 
Using xslt in mule
Khan625
 
Using xslt in mule
javeed_mhd
 
Using xslt in mule
Rajkattamuri
 
Using xslt in mule
mdfkhan625
 
Using xslt in mule
AbdulImrankhan7
 
Mule xml transformation
D.Rajesh Kumar
 
Xml to xml transformation in mule
javeed_mhd
 
Xml to xml transformation in mule
Rajkattamuri
 
Xml to xml transformation in mule
Mohammed625
 
Xml transform
Son Nguyen
 
Xml to xml transformation in mule
mdfkhan625
 
Xml to xml transformation in mule
Domenico Schiavone
 
Xml to xml transformation
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
 
Rest based api with xslt transformation
Nazia Abdullah
 
Converting with custom transformer part 2
Anirban Sen Chowdhary
 
Xslt mule
Sindhu VL
 
Mule esb and_relevant_components
Paaras Baru
 
Ad

More from Shahid Shaik (7)

PPTX
Jenkins2
Shahid Shaik
 
PPT
SOAP, WSDL and UDDI
Shahid Shaik
 
PPT
Mule webservices in detail
Shahid Shaik
 
PPTX
SOAP Services
Shahid Shaik
 
PPTX
Web service vm in mule
Shahid Shaik
 
PPTX
Testing soapui
Shahid Shaik
 
PPTX
Java in Mule
Shahid Shaik
 
Jenkins2
Shahid Shaik
 
SOAP, WSDL and UDDI
Shahid Shaik
 
Mule webservices in detail
Shahid Shaik
 
SOAP Services
Shahid Shaik
 
Web service vm in mule
Shahid Shaik
 
Testing soapui
Shahid Shaik
 
Java in Mule
Shahid Shaik
 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 

Xslt in mule

  • 2. We often use XSLT in our application to transform XML payload from one form to another . Mule also supports XSLT in it’s application with XSLT-Transformer component.
  • 3. So, How can we use XSLT in Mule application?? .
  • 4. Here I will show you how ……
  • 5. Before we start we must see what an XSLT actually is :- As per XSLT definition :- XSLT (Extensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or into XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF PostScript and PNG. Source :- http://en.wikipedia.org/wiki/XSLT
  • 6. So, XSLT can be use to transform one form of XML to another :- Here you can see the XSLT is transforming the XML payload into another XML
  • 7. So, let us try this example in our Mule application Here we will be using XSLT for transforming the XML payload into another XML like below :-
  • 8. So let’s consider we have a following flow in our Mule application:- As you can see we have used a Http inbound end point followed by a set payload component and then XSLT transformer. Here the set payload contain the XML that need to be transform
  • 9. So set payload component contains the following payload :-
  • 10. Our corresponding Mule flow will be as follows :- <flow name="xsltFlow1" doc:name="xsltFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" doc:name="HTTP"/> <set-payload value="&lt;RootElement&gt;&lt;Name&gt;Anirban&lt;/Name&gt;&lt;Department&gt;ATS&lt;/D epartment&gt;&lt;Designation&gt;SSE&lt;/Designation&gt;&lt;/RootElement&gt;" doc:name="Set Payload"/> <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" outputEncoding="UTF-8" doc:name="Transform from outer to inner" xsl-file="Transform.xslt" encoding="UTF-8" returnClass="java.lang.String" /> </flow> As you can see we are using XSLT file :- Transform.xslt
  • 11. So, the file Transform.xslt should be in our src/main/resource folder
  • 12. The file Transform.xslt Contains following code to transform :- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes" /> <xsl:template match="/"> <NewRootElement> <NewName> <xsl:value-of select="RootElement/Name" /> </NewName> <NewDepartment> <xsl:value-of select="RootElement/Department" /> </NewDepartment> <NewDesignation> <xsl:value-of select="RootElement/Designation" /> </NewDesignation> </NewRootElement> </xsl:template> </xsl:stylesheet>
  • 13. To test the application we hit the url http://localhost:8081/test in our browser and we get the following :- And you can see the XML payload has been transferred to this new XML
  • 14. Hope you enjoyed the simple yet an amazing trick in Mule