Creating a user-defined function
When creating a user-defined function, you must specify the UDF name, input and output parameters, and the XSLT code to make the UDF valid.
To add a user-defined function:
-
Select Template Functions > create-custom and drag the widget into the scope container.
Alternatively, right-click in the function editor’s scope container and select Add User-Defined Function.
-
Specify these user-defined function properties:
- Function name
- Specify a unique identifier for the function being created.
- Input Parameter Name and dataType
- Specify the name and data type of the input parameters of the function. The selected input data type of each property must match the types of the function inputs.
- To add more input parameters, click the + icon.
- Output dataType
- Specify the type of the output of the user-defined function. The selected output data type must match the type of the next function or the type of the target element.
- NameSpace <ns>
- The declared function must come from a namespace outside of the XSLT namespace. The URL that is provided does not have to exist but you must associate it with your company and project.
- For example,
http://yourcompanyandproject
. - The NameSpace <ns> field is located in the pop-up window that is displayed when you click the Edit Function icon. This icon is located in the lower left corner of the user-defined function widget.
- Function Body
- Declare the function in XSLT 2.0 syntax.
- The Function Body field is located in the pop-up window that is displayed when you click the Edit Function icon. This icon is located in the lower left corner of the user-defined function widget.
- Parameter as dataType
- Specify input parameters for the function. The data type must match the output data type of the function input.
- Click the + icon to add input parameters.
- Return dataType
- Specify the output type of the user-defined function. This must match the input type of the next function or the end node.
- Omit parent elements
- Select this check box to omit parent XML elements. The parent elements are not transferred to the XML output.