Can the Mule ESB DataMapper generate XSLT

时光怂恿深爱的人放手 提交于 2019-12-13 06:59:40

问题


Given a DataMapper node that would map between the following two structures:

Strcuture A:

<item>
  <id>123</id>
  <price>1</price>
  <quantity>1</quantity>
</item>
<item>
  <id>124</id>
  <price>2</price>
  <quantity>1</quantity>
</item>
<item>
  <id>125</id>
  <price>3</price>
  <quantity>1</quantity>
</item>

Structure B:

<total>
  <totalPrice>6</totalPrice>
</total>

The Mule ESB DataMapper will generate a CTL2 (Clover) Transformation.

Can the Mule ESB DataMapper also generate XSLT


回答1:


Do you mean to perform a XML transformation? Because if this is the case then yes.

If what you mean is to generate XSLT, technically I can, but makes no sense as XSLT is not meant to contain information but rather to transform it.




回答2:


I guess XSLT (Extensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents and I am afraid Data mapper cannot generate a XSLT ...

you can always use Mule XSLT transformer separately to transform data into your expected format of XML:- http://www.mulesoft.org/documentation/display/current/XSLT+Transformer




回答3:


You can use XSLT component and provide an xsl file. This xsl file would be convert between 2 different sml formats.

Below is the example of mule flow for the same.

<file:connector name="File"  autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<flow name="xsltexampleFlow">
    <file:inbound-endpoint path="D:\Mule_Work\Input" connector-ref="File" responseTimeout="10000" doc:name="File"/>
    <logger message="------------------File Read------------" level="INFO" doc:name="Logger"/>
    <mulexml:xslt-transformer xsl-file="D:\Mule_Work\Output\transform.xsl" maxIdleTransformers="2" maxActiveTransformers="5" doc:name="XSLT"/>
    <logger level="INFO" doc:name="Logger" message="--------------XSL Transformation---------------------"/>
    <file:outbound-endpoint path="D:\Mule_Work\Output" outputPattern="Output_transform.xml" connector-ref="File" responseTimeout="10000" doc:name="File"/>
</flow>



来源:https://stackoverflow.com/questions/27969243/can-the-mule-esb-datamapper-generate-xslt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!