Hi @prajwal M R !
You can re utilize the xslt you have already, but you need to be aware to provide all the libraries or replace them.
Here is a basic usage of it and I'm also attaching the updated xslt that worked for me:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:xml-module="http://www.mulesoft.org/schema/mule/xml-module"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/xml-module http://www.mulesoft.org/schema/mule/xml-module/current/mule-xml-module.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<flow name="simple-testFlow" doc:id="99235cf9-33ce-4aa9-8f8a-aeb5e9f4a935" >
<scheduler doc:name="Scheduler" doc:id="0f62fff3-b06a-4d80-a469-b99351e4f161" >
<scheduling-strategy >
<fixed-frequency timeUnit="MINUTES"/>
</scheduling-strategy>
</scheduler>
<ee:transform doc:name="Transform Message" doc:id="2a506544-cff4-463c-ae2a-171e47a85bba" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
{
root:
{
targetSample : 'TargetValue',
senderSample : 'SenderValue'
}
}]]></ee:set-payload>
</ee:message>
</ee:transform>
<xml-module:xslt-transform doc:name="Xslt transform" doc:id="f9fc4bf1-22f3-4be8-97ca-c32d856eb6fb">
<xml-module:xslt><![CDATA[${file::test.xslt}]]></xml-module:xslt>
</xml-module:xslt-transform>
<ee:transform doc:name="Transform Message" doc:id="594f3700-d013-417c-a781-5f5fa0c8ce75" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
read(payload,'application/xml')]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Logger" doc:id="133d91b0-aa68-4553-b8d8-0880eff81feb" message="#payload"/>
</flow>
</mule>
In this sample you will see that a scheduler is triggering the flow ( you can use any other) , and it's using from the XML module the xslt-transform processor . After the xslt is executed I added a transformation to get the xml otherwise, it's a plain string.
Hope it help!
Good luck!
Juan Cruz Basso
2 réponses