Transforming Data Using XSLTs

In WebLogic Workshop business processes, XML data can be transformed using either XQuery expressions or eXtensible Stylesheet Language Transformations (XSLTs). An XQuery expression or query, is written in the XQuery language—a language defined by the World Wide Web Consortium (W3C) that provides a vendor independent language for the query and retrieval of XML data. An XSLT is written in the eXtensible Stylesheet Language (XSL)—an older language defined by the W3C that supports the use of stylesheets for the conversion of XML data.

To learn about XSLT, see the XSL Transformations (XLST) Version 1.0-W3C Recommendation 16 November 1999 at the web site of the W3C at the following URL:

http://www.w3.org/TR/xslt

The XSLT processor which is invoked by the transformation conforms to the November 16, 2002 Recommendation of the XSLT Specification.

WebLogic Workshop provides functionality for executing existing XSLTs in business processes. However, in WebLogic Workshop, the preferred method for data transformations is to use queries in the XQuery language. To learn more about adding queries to your business process, see Transforming Data Using XQuery. Data transformation using XSLT is supported primarily for customers who have upgraded from prior versions of WebLogic Integration and wish to continue using their XSLT-based maps without modification.

This section contains the following tasks:

To Import an Existing XSLT file

This task describes how to import an XSLT file into your project.

  1. In the Application tab, right-click any project folder (project folder names end with the string: Web) or product subfolder. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)
  2. Warning: Do not import the XSLT file into a Schemas project folder. (To learn more, see a Creating Schemas Projects.)

  3. From the drop-down menu, select Import... .
  4. The Import Files dialog box is displayed.

  5. Browse the file system, select your XLST file (files that end with the .xsl extension), and click Import.
  6. The XSLT file is imported into the project.

To Add a Data Transformation to a Business Process Using an XSLT

  1. Select or create a Transformation file (also know as a DTF file because it ends in the .dtf extension). (For instructions on creating a Transformation file see Creating a Transformation File and a Transformation Method.
  2. In the Application tab, expand the folders that contain the Transformation file. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)

  3. Select or create a Transformation method in a Transformation file. (For instructions on creating a method in a Transformation file, see Creating a Transformation File and a Transformation Method.)
  4. In the Design View, right-click the arrow representing the method.

  5. From the drop-down menu, select Configure XSLT Transformation Method.
  6. The Configure XSLT Transformation Method dialog box is displayed.

  7. From the XSLT Transformation File drop-down menu, select the appropriate XSLT file.
  8. If your XSLT accepts parameters, add parameters to the Transformation method.
  9. Repeat the following steps for each parameter of the XSLT:

    1. In the Parameter Name field, enter the name of the XSLT parameter as it appears in the XSLT file.
    2. From the Parameter Type drop-down menu, select the appropriate Parameter Type.
    3. Click Add.
    4. Note: The parameter name entered in the Parameter Name field, must match the parameter name specified in the XSLT file. For example, if taxrate is specified as a parameter in the XSLT source file, the same name (taxrate) must be specified in the Parameter Name field. The following segment of an example XSLT file shows the declaration of the variable taxrate:

      <?xml version="1.0" encoding="utf-8"?>
      <xsl:stylesheet xmlns:xsl="http://www.acme.com/trans" version="1.0">
      	<xsl:output method="update" indent="yes" /> 
      	<xsl:param name="taxrate"/>
      ... 
      

      Note: In the Configure XSLT Transformation Method dialog box, the order of the parameters specified is not significant. The parameters of the XSLT are matched to the parameters of the Transformation method by name.

  10. Click OK.
  11. This links the XSLT file with the selected method in the Transformation file. During run time, if the business process invokes this method, this XSLT is invoked.

Previous Document Next Document