8. command-menu

Inserts a command-button in generated content. Unlike command-button(), command-menu() dynamically computes its menu items (typically specified using xpath()) before displaying its popup menu.

Do not specify the menu parameter for this type of command-button(). Instead, specify command, values and optionally, parameter and labels parameters.

labelsList of strings separated by new lines ("\A ")None (use values as labels)Specifies the labels of the menu items.
valuesList of strings separated by new lines ("\A ")None. Required.Specifies the values of the menu items. These values are passed as a parameter to the command executed by this command-menu(). More information below.

The popup menu items specified this way all trigger the same command. This command corresponds to the value of key command. However each menu item uses a specific command parameter:

Unless a value has been specified for key text or icon, a command-menu() uses icon(pop-down) at its icon.

Simple example:

command-menu(text, "Say Hello",
             command, "alert",
             labels, "English\A Français\A Deutsch"
             values, "Hello!\A Salut!\A Tschüss!");

The above button displays a popup menu containing 3 items: "English", "Français", "Deutsch". First item invokes command alert with parameter "Hello!"; second item invokes command alert with parameter "Salut!"; third item invokes command alert with parameter "Tschüss!".

Dynamic menu items example:

command-menu(tool-tip, "Select a name",
  command, "putAttribute",
  parameter, "name %V",
  xpath("join(document(resolve-uri('name.list', $styleSheetURL))//item, '\A ')"))

where XML file name.list looks like this:


See also xpath.