SlideShare a Scribd company logo
Using XSLT in Mule (For beginner )
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

Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
Rajkattamuri
 
Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
Mani Rathnam Gudi
 
Mule Message Properties Component
Mule Message Properties ComponentMule Message Properties Component
Mule Message Properties Component
Durga Prasad Kakarla
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
F K
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
Anirban Sen Chowdhary
 
Choice component in mule demo
Choice component in mule demoChoice component in mule demo
Choice component in mule demo
Sudha Ch
 
Mule accessing multiple database in parallel
Mule accessing multiple database in parallelMule accessing multiple database in parallel
Mule accessing multiple database in parallel
Anirban Sen Chowdhary
 
Mule requesterdemo
Mule requesterdemoMule requesterdemo
Mule requesterdemo
Anirban Sen Chowdhary
 
Mule esb
Mule esbMule esb
Mule esb
Khan625
 
Mule overview-ppt
Mule overview-pptMule overview-ppt
Mule overview-ppt
Prabhat gangwar
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
Anirban Sen Chowdhary
 
File component in mule
File component in muleFile component in mule
File component in mule
Rajkattamuri
 

What's hot (12)

Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
 
Mule Message Properties Component
Mule Message Properties ComponentMule Message Properties Component
Mule Message Properties Component
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
 
Choice component in mule demo
Choice component in mule demoChoice component in mule demo
Choice component in mule demo
 
Mule accessing multiple database in parallel
Mule accessing multiple database in parallelMule accessing multiple database in parallel
Mule accessing multiple database in parallel
 
Mule requesterdemo
Mule requesterdemoMule requesterdemo
Mule requesterdemo
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule overview-ppt
Mule overview-pptMule overview-ppt
Mule overview-ppt
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
File component in mule
File component in muleFile component in mule
File component in mule
 

Viewers also liked

Mule oracle connectors
Mule oracle connectorsMule oracle connectors
Mule oracle connectors
Praneethchampion
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
Praneethchampion
 
Soap request in mule
Soap request in mule Soap request in mule
Soap request in mule
Praneethchampion
 
Damaging damzelz' no.1
Damaging damzelz' no.1Damaging damzelz' no.1
Damaging damzelz' no.1
tailgunnerx1
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
Praneethchampion
 
How to use expression filter
How to use expression filter How to use expression filter
How to use expression filter
Praneethchampion
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
Praneethchampion
 
Mule real-world-old
Mule real-world-oldMule real-world-old
Mule real-world-old
Praneethchampion
 
Mule soap
Mule soapMule soap
Mule soap
Praneethchampion
 
Mule security-jaas
Mule security-jaasMule security-jaas
Mule security-jaas
Praneethchampion
 
Mule velocity
Mule velocityMule velocity
Mule velocity
Praneethchampion
 
Creating dynamic json in mule
Creating dynamic json in muleCreating dynamic json in mule
Creating dynamic json in mule
Praneethchampion
 
Mmc rest api user groups
Mmc rest api user groups Mmc rest api user groups
Mmc rest api user groups
Praneethchampion
 
Documantation with mule
Documantation with mule Documantation with mule
Documantation with mule
Praneethchampion
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
Praneethchampion
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
Praneethchampion
 
Mule technology
Mule technologyMule technology
Mule technology
Praneethchampion
 
Webservice vm in mule
Webservice vm in muleWebservice vm in mule
Webservice vm in mule
Praneethchampion
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
Praneethchampion
 

Viewers also liked (20)

Mule oracle connectors
Mule oracle connectorsMule oracle connectors
Mule oracle connectors
 
CSP Review Report_Final (1)
CSP Review Report_Final (1)CSP Review Report_Final (1)
CSP Review Report_Final (1)
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 
Soap request in mule
Soap request in mule Soap request in mule
Soap request in mule
 
Damaging damzelz' no.1
Damaging damzelz' no.1Damaging damzelz' no.1
Damaging damzelz' no.1
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
How to use expression filter
How to use expression filter How to use expression filter
How to use expression filter
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Mule real-world-old
Mule real-world-oldMule real-world-old
Mule real-world-old
 
Mule soap
Mule soapMule soap
Mule soap
 
Mule security-jaas
Mule security-jaasMule security-jaas
Mule security-jaas
 
Mule velocity
Mule velocityMule velocity
Mule velocity
 
Creating dynamic json in mule
Creating dynamic json in muleCreating dynamic json in mule
Creating dynamic json in mule
 
Mmc rest api user groups
Mmc rest api user groups Mmc rest api user groups
Mmc rest api user groups
 
Documantation with mule
Documantation with mule Documantation with mule
Documantation with mule
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Mule technology
Mule technologyMule technology
Mule technology
 
Webservice vm in mule
Webservice vm in muleWebservice vm in mule
Webservice vm in mule
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 

Similar to xslt in mule

Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
Sunil Komarapu
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
Shahid Shaik
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
Hasan Syed
 
Xml transform
Xml transformXml transform
Xml transform
Son Nguyen
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
Mohammed625
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
javeed_mhd
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
mdfkhan625
 
Xml to xml transformation
Xml to xml transformationXml to xml transformation
Xml to xml transformation
Son Nguyen
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
Germano Barba
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
Davide Rapacciuolo
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
Davide Rapacciuolo
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
Davide Rapacciuolo
 
Xml toobjectesbtransform
Xml toobjectesbtransformXml toobjectesbtransform
Xml toobjectesbtransform
Domenico Schiavone
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
Antonio Pellegrino
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
Germano Barba
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
Davide Rapacciuolo
 
XSLT
XSLTXSLT
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
Stephan Schmidt
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
javeed_mhd
 
Transforming with custom transformer in mule
Transforming with custom transformer in muleTransforming with custom transformer in mule
Transforming with custom transformer in mule
Praneethchampion
 

Similar to xslt in mule (20)

Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xml transform
Xml transformXml transform
Xml transform
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation
Xml to xml transformationXml to xml transformation
Xml to xml transformation
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Xml toobjectesbtransform
Xml toobjectesbtransformXml toobjectesbtransform
Xml toobjectesbtransform
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
XSLT
XSLTXSLT
XSLT
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
 
Transforming with custom transformer in mule
Transforming with custom transformer in muleTransforming with custom transformer in mule
Transforming with custom transformer in mule
 

More from Praneethchampion

Mule execution
Mule executionMule execution
Mule execution
Praneethchampion
 
Mule soa
Mule soaMule soa
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
Praneethchampion
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
Praneethchampion
 
Dataweave
Dataweave Dataweave
Dataweave
Praneethchampion
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
Praneethchampion
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
Praneethchampion
 
Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
Praneethchampion
 
Mule security
Mule securityMule security
Mule security
Praneethchampion
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mule
Praneethchampion
 
Mule rabbitmq
Mule rabbitmqMule rabbitmq
Mule rabbitmq
Praneethchampion
 
Mule drools
Mule drools Mule drools
Mule drools
Praneethchampion
 
Mule esb DataWeave
Mule esb DataWeaveMule esb DataWeave
Mule esb DataWeave
Praneethchampion
 
Idempotent filter in mule
Idempotent filter in muleIdempotent filter in mule
Idempotent filter in mule
Praneethchampion
 

More from Praneethchampion (15)

Mule execution
Mule executionMule execution
Mule execution
 
Mule soa
Mule soaMule soa
Mule soa
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Dataweave
Dataweave Dataweave
Dataweave
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
 
Mmc
Mmc Mmc
Mmc
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
 
Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
 
Mule security
Mule securityMule security
Mule security
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mule
 
Mule rabbitmq
Mule rabbitmqMule rabbitmq
Mule rabbitmq
 
Mule drools
Mule drools Mule drools
Mule drools
 
Mule esb DataWeave
Mule esb DataWeaveMule esb DataWeave
Mule esb DataWeave
 
Idempotent filter in mule
Idempotent filter in muleIdempotent filter in mule
Idempotent filter in mule
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

xslt in mule

  • 1. Using XSLT in Mule (For beginner )
  • 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