Using external XSL transformation in Talend Data Mapper
In previous versions of Talend Data Mapper, you can create a map with support for XSLT Report, which allows you to apply an XSL transformation to a Structure and provides you an HTML or XML result. However in version 7.0 and onwards, this support has been deprecated. If you wish to continue receiving an HTML or XML result in version 7.0 and onwards, you need to use an external XSL transformation such as the tXSLT component.
The following shows you an example scenario of a Job that uses an external XSL transformation:
- Create the input XSL and XML files in your local machine, such
<catalog> <cd> <title>foo-1</title> <artist>bar-1</artist> <price>13.90</price> </cd> <cd> <title>foo-2</title> <artist>bar-2</artist> <price>07.90</price> </cd> </catalog>
Name the file as cd.xml and cd.xsl.
- Create a Talend Data Mapper map of
XSLT Report Type with the JSON input structure. In the Properties window,
specify the XML file you created previously.
Adding components to the Job
In this scenario, use these components: tFileInputRaw, tHMap, tFileOutputRaw, and tXSLT.
- Navigate to to create a Standard Job.
Add the following components:
- Connect the first three components using the connection.
- Connect the tFileOutputRaw to tXSLT using the connection.
Configuring and running the Job
To successfully run the Job, configure the components, where required.
- In the tFileInputRaw Basic Settings tab, specify the filepath of the XSL input file you created in the Filename field .
- In the thMap Basic Settings tab, specify the Talend Data Mapper Map you created in the Map Path field.
- In the tFileOutputRaw Basic Settings tab, specify "/tmp/out.html" in the Filename field.
In the tXSLT Basic Settings tab, specify the following
- XML file: Specify the filepath of the XML input file you created earlier.
- XSL file: Specify the filepath of the XSL input file you created earlier.
- Output file: Specify "/tmp/out.html" in the field.
- Click Run to execute the Job.