Reputation: 207
I have this Mule flow:
<file:connector name="input" doc:name="input" autoDelete="false" />
<flow name="flow1">
<file:inbound-endpoint connector-ref="input" responseTimeout="10000" doc:name="input" path="C:\test" pollingFrequency="100000" />
<file:filename-wildcard-filter pattern="prod.xml" />
<set-variable variableName="tempid" value="150" doc:name="Variable" />
<foreach doc:name="For Each" collection="#[xpath3('//marketingdetailslist/marketdetails/*', payload, 'NODESET' )]">
<enricher source="#[flowVars.tempid]" target="#[xpath3('//marketdetails/target')]" >
<logger message="inside enricher ~~~~~#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</enricher>
</foreach>
<logger message="after enrichment response~~~~~~.......#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</flow>
Which receives this XML as input:
<marketingdetailslist>
<marketdetails>
<Jan>
<target>100</target>
<productname>Electronics</productname>
</Jan>
<Feb>
<target>50</target>
<productname>Woodenitems</productname>
</Feb>
</marketdetails>
</marketingdetailslist>
And this would be the expected output, having the values change:
<marketingdetailslist>
<marketdetails>
<Jan>
<target>150</target>
<productname>Electronics</productname>
</Jan>
<Feb>
<target>150</target>
<productname>Woodenitems</productname>
</Feb>
</marketdetails>
</marketingdetailslist>
I can't get the expected output. What would I need to change in my flow to achieve that?
Upvotes: 2
Views: 1006
Reputation: 33413
It seems you are trying to emulate the XSL-T Transformer with a set of message processors. You may succeed but it would be much better to use XSL-T instead, as it is designed for performing this kind of transformation.
Upvotes: 2