# @dtf:transform Annotation

The @dtf:transform annotation annotates the XQuery and XSLT abstract methods in a DTF file. During run time, a business process (JPD) invokes the abstract method which in turn invokes the associated XSLT or query (written in the XQuery language.)

Syntax

The @dtf:transform annotation can specify one and only one of the following attributes:

- xquery-ref Attribute
- xquery Attribute
- xslt-ref Attribute
- xslt Attribute

#### xquery-ref Attribute

@dtf:transform

xquery-ref="myTrans.xq"

Where myTrans specifies the XQ file that contains the query written in the XQuery language. During run time, if the abstract method is invoked by a business process, the associated query stored in the XQ file is invoked by the XQuery engine.

The following example code segment shows a @dtf:transform annotation specifying the xquery-ref attribute:

    /**
     * @dtf:transform xquery-ref="myXQueryMethod.xq"
     * @dtf:schema-validate return-value="false" parameters="false"
     */
    public abstract noNamespace.SupplierDocument myXQueryMethod(noNamespace.PurchaseOrderDocument PurchaseOrderDoc);

During run time, if the myXQueryMethod abstract method is invoked by a business process, the query stored in the myXQueryMethod.xq is invoked by the XQuery engine.

A dtf:transform annotation with the xquery-ref attribute is generated when you create a transformation method in a DTF file and configure the transformation method to be a XQuery method. To learn more, see Creating a Transformation File and a Transformation Method in the Guide to Data Transformation.

#### xquery Attribute

@dtf:transform xquery ::

xquery_code
::

Where xquery_code specifies the inline query (written in the XQuery language) to be invoked by the business process during run time.

The following example code segment shows a @dtf:transform annotation specifying the xquery attribute:

    /**
     * @dtf:transform xquery ::
     * <Supplier>
     *  <id>{ data($PurchaseOrderDoc/partId) }</id>
     * </Supplier>
     * ::
     */
    public abstract noNamespace.SupplierDocument myXQueryInlineMethod(noNamespace.PurchaseOrderDocument PurchaseOrderDoc);

The unbound source variables used in the XQuery code must correspond in name and type to the Java transformation (abstract) method parameters defined in the DTF file. (An unbound source variable is a variable used in the XQuery code that is not first defined by an XQuery let statement.) As shown highlighted in bold in the preceding example code listing, the source $PurchaseOrderDoc variable used in the inline XQuery code is defined as the parameter in the myXQueryInlineMethod transformation method as type: PurchaseOrderDocument.

You can add the @dtf:transform annotation with the xquery attribute using one of the following procedures:

- Open the DTF file in the Source View and enter the @dtf:transform annotation with the xquery attribute as shown in the presiding example code listing.
- Using the Property Editor:

1. Open the DTF file in the Design View.
2. In the Design View, select a Transformation (abstract) method.
3. In the Property Editor, under transform, click the xquery attribute.

The field to the right of the xquery attribute becomes active.

4. Paste the query into the xquery field.

#### xslt-ref Attribute

@dtf:transform

xslt-ref="myXSL.xsl"

Where myXSL specifies the XSL file that contains the eXtensible Stylesheet Language code. XSLT is an older language defined by the W3C that supports the use of style sheets for the conversion of XML data.

The following example code segment shows a @dtf:transform annotation specifying the xslt-ref attribute:

    /**
     * @dtf:transform xslt-ref="../myXSLT.xsl"
     */
    public abstract com.bea.xml.XmlObject myXsltMethod(com.bea.xml.XmlObject source);

During run time, if the myXsltMethod abstract method is invoked by a business process, the associated XSLT stored in the myXSLT.xsl is invoked by the XSLT processor.

The return type and the first parameter of the method must be XmlObject or a typed XMLBeans class. The remaining parameters are treated as XSLT parameters.

A dtf:transform annotation with the xslt-ref attribute is generated when you create a transformation method in a DTF file and configure the transformation method to be a XSLT method. To learn more, see Transforming Data Using XSLTs in the Guide to Data Transformation.

#### xslt Attribute

@dtf:transform xslt ::

XSL_Code
::

Where XSL_code specifies the inline XSL code to be invoked by the business process during run time.

The return type and the first parameter of the method must be XmlObject or a typed XMLBeans class. The remaining parameters are treated as XSLT parameters.

You can add the @dtf:transform annotation with the xslt attribute using one of the following procedures:

1. Open the DTF file in the Source View and enter the @dtf:transform annotation with the xslt attribute above the Java code defining the XSLT transformation method.
2. In the Property Editor, open the DTF file in the Design View.
3. In the Design View, select a Transformation (abstract) method.
4. In the Property Editor, under transform, click the xslt attribute.
5. The field to the right of the xslt attribute becomes active.
6. Paste the XSL code into the xslt field.

Related Topics

Guide to Data Transformation

Tutorial: Building Your First Data Transformation