简体   繁体   中英

Can the Mule ESB DataMapper generate XSLT

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

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

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM