Using external XSL transformation in Data Mapper - 7.3

author
Talend Documentation Team
EnrichVersion
7.3
EnrichProdName
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Processing components (Integration) > Data mapping
Data Quality and Preparation > Third-party systems > Processing components (Integration) > Data mapping
Design and Development > Third-party systems > Processing components (Integration) > Data mapping
EnrichPlatform
Talend Studio

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:

Prerequisite

  • Create the input XSL and XML files in your local machine, such as:
    <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.

Procedure

  1. Navigate to Repository > Job Designs > Standard to create a Standard Job.
  2. Add the following components:
    • tFileInputRaw
    • tHMap
    • tFileOutputRaw
    • tXSLT
  3. Connect the first three components using the Row > Main connection.
  4. Connect the tFileOutputRaw to tXSLT using the Trigger > OnComponentOk connection.

Configuring and running the Job

To successfully run the Job, configure the components, where required.

Procedure

  1. In the tFileInputRaw Basic Settings tab, specify the filepath of the XSL input file you created in the Filename field .
  2. In the thMap Basic Settings tab, specify the Talend Data Mapper Map you created in the Map Path field.
  3. In the tFileOutputRaw Basic Settings tab, specify "/tmp/out.html" in the Filename field.
  4. In the tXSLT Basic Settings tab, specify the following values:
    • 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.
  5. Click Run to execute the Job.