XPath/XQuery Functions
|
Opens the XPath Functions dialog, which lists all the user-defined XPath functions in the project. These XPath functions can be used in all XPath expressions in the project. You can add and delete functions using the corresponding icons in the toolbar of the dialog. To edit the definition of a function, click the function's Edit XPath Expression button.
Add a new user-defined XPath functionAdding a new user-defined function involves two steps: (i) declaring the function, and (ii) defining the function.
To add a new function, do the following, click Add in the toolbar of the dialog (see screenshot above). This displays the New XPath Function dialog (screenshot below).In this dialog, you can declare the name of the function, specify the number of function parameters (arguments) and their types, and specify the return type of the function. In the screenshot above we have declared a function to convert a decimal number from Celsius to Fahrenheit. The function takes one parameter, which is the input Celsius value as a decimal. It will output a decimal value, the Fahrenheit temperature. What the function does is defined in the next step. After declaring the function (screenshot above), click OK. This displays the Edit Function dialog (screenshot below), which contains the template of the newly declared function and in which you can now define the function. Enter the definition of the function within the braces. In the definition shown in the screenshot above, $a is the input parameter. Click OK. when done. The function will be added to the list of user-defined functions in the XPath Functions dialog and can be used in all XPath expressions in the project.
|