You use the New Function dialog box to create a user-defined function based on code that you have selected in the XQuery text editor. This command prompt for a function name and then copies the selection into the newly created local function, and replaces the selection with the function call.