How to pass parameters to a Java Code from XSLT (Custom Java Function ).

How to pass parameters to a Java Code from XSLT (Custom Java Function ).

book

Article ID: KB0093597

calendar_today

Updated On:

Products Versions
TIBCO API Exchange -
Not Applicable -

Description

Description:
The documentation refers to calling a Java function which takes no input but provides a response. To further enhance the Java functionality you can also pass parameters from the XSL file to the Java function.

Issue/Introduction

How to pass parameters to a Java Code from XSLT (Custom Java Function ).

Resolution

The parameters must be typecasted in the XSL file for the call.

Example:

<xsl:value-of select="nameUtils:magDat(xs:integer(111))"/>

Here magDat is the function name which expects an integer parameter. You can also pass a variable as shown below:

<xsl:value-of select="nameUtils:magDat(xs:integer($variable))"/>


where variable is a <xsl:variable> element.


Since xs:integer is part of the w3 schema, refer the same in the namespaces by adding the following:


xmlns:xs="http://www.w3.org/2001/XMLSchema"


Note that the above is an example for a one parameter function. It can be extended for multiparameters by passing comma separated input parameters.

Attached is a sample jar and XSL (Filenames: magdat.jar and test.xsl) demonstrating calling of the Java function from within the jar from the XSL.

Additional Information

https://docs.tibco.com/pub/api-exchange-gateway/2.1.1/doc/html/TIB_api-exchange-gateway_users_guide/wwhelp/wwhimpl/common/html/wwhelp.htm#href=EndtoEndFlowandTransformations.10.10.htm&single=true

Attachments

How to pass parameters to a Java Code from XSLT (Custom Java Function ). get_app
How to pass parameters to a Java Code from XSLT (Custom Java Function ). get_app