User-defined function example

This example shows how to create a user-defined function. Two input parameters of type decimal and a return type of type decimal are used. You can create a function to calculate a percentage that is based on the value of the two input parameters.

Create a user-defined function:

  1. Specify this information:
    NameSpace <ns>
    http://inforTemplateFunctions
    Function name
    Percentage
    Parameter as dataType
    value1 - decimal
    value2 - decimal
    Function Body
    <xsl:value-of select="(100* $value2) div $value1" />
    Return dataType
    decimal
  2. When you have a fully defined user-defined function, you can save it and reuse it within the scope of the current mapping version.
    The user-defined function is saved to the Function Tree under User-Defined Functions.