July 30, 2023

tXSLT – Docs for ESB 7.x

tXSLT

Helps to transform data structure to another structure.

This component refers to an XSL stylesheet, to transform an XML source file
into a defined output file.

tXSLT Standard properties

These properties are used to configure tXSLT running in the Standard Job framework.

The Standard
tXSLT component belongs to the XML family.

The component in this framework is available in all Talend
products
.

Basic settings

XML file

File path to the XML file to be validated.

XSL file

File path to the reference XSL transformation file.

Output file

File path to the output file. If the file does not exist, it will
be created. The output file can be any structured or unstructured
file such as html, xml, txt or even pdf or edifact depending on your
xsl.

Parameters

Click the plus button to add new lines in the Parameters list and define the
transformation parameters of the XSLT file. Click in each line and
enter the key in the name list and its
associated value in the value list.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the processing metadata at the Job
level as well as at each component level.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

OUTPUT_FILEPATH: the output file path. This is a Flow
variable and it returns a string.

OUTPUT_FILENAME: the output file name. This is a Flow
variable and it returns a string.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component can be used as standalone component.

Limitation

Due to license incompatibility, one or more JARs required to use
this component are not provided. You can install the missing JARs for this particular
component by clicking the Install button
on the Component tab view. You can also
find out and add all missing JARs easily on the Modules tab in the
Integration
perspective of your studio. You can find more details about how to install external modules in
Talend Help Center (https://help.talend.com)
.

Transforming XML to html using an XSL stylesheet

This scenario describes a two-component Job that converts xml data into an html
document using an xsl stylesheet. It as well defines a transformation parameter of the
xsl stylesheet to change the background color of the header of the created html
document.

Procedure

  1. Drop the tXSLT and tMsBox components from the Palette to the design workspace.

    tXSLT_1.png

  2. Double-click tXSLT to open its Basic settings view where you can define the
    component properties.

    tXSLT_2.png

  3. In the XML file field, set the path or browse
    to the xml file to be transformed. In this example, the xml file holds a list of
    MP3 song titles and related information including artist names, company
    etc.

    tXSLT_3.png

  4. In the XSL file field in the Basic settings view, set the path or browse to the
    relevant xsl file.
  5. In the Output file field, set the path or
    browse to the output html file.

    In this example, we want to convert the xml data into an html file holding a
    table heading followed by a table listing artists’ names next to song titles.
    tXSLT_4.png

  6. In the Parameters area of the Basic settings view, click the plus button to add a
    line where you can define the name and value of the transformation parameter of
    the xsl file. In this example, the name of the transformation parameter we want
    to use is bgcolor and the value is green.

  7. Double-click the tMsgBox to display its
    Basic settings view and define its display
    properties as needed.

    tXSLT_5.png

  8. Save the Job and press F6 to execute it. The
    message box displays confirming that the output html file is created and stored
    in the defined path.

    tXSLT_6.png

  9. Click OK to close the message box.

You can now open the output html file to check the transformation of the xml data and
that of the background color of the table heading.

tXSLT_7.png


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x