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.
Key | Value | Default | Description |
---|---|---|---|
labels | List of strings separated by new lines ("\A ") | None (use values as labels ) | Specifies the labels of the menu items. |
values | List 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:
If key parameter
has been specified, its value must contain variable %V
. Variable %V
is replaced by the value of a menu item.
If key parameter
has not been specified, the value of a menu item is used as the parameter of the command.
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", values, xpath("join(document(resolve-uri('name.list', $styleSheetURL))//item, '\A ')"))
where XML file name.list
looks like this:
<list> <item>John</item> <item>Paul</item> <item>George</item> <item>Ringo</item> </list>
See also xpath
.