64. putAttribute
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 64. putAttribute

Parameter syntax:

    [ '[implicitElement]' ]? [ '[empty]'|'[none]'|'[id]' ]? [ '[simplePrompt]'|'[normalDialog]' ]?
    attribute_name [ attribute_value ]?

This command is only useful to write macro commands.

Adds or replaces attribute `attribute_name` in explicitly or implicitly selected element if grammar constraining the document allows to do so.

- If attribute value `attribute_value` is specified then this value is used as the new value of attribute `attribute_name` (this value is checked for validity),

- otherwise

  - If `[empty]` has been specified, sets the attribute to the empty string (without checking if it is a valid value).

  - If `[dummy]` has been specified, sets the attribute to string "`???`" (without checking if it is a valid value).

  - If `[id]` has been specified, sets the attribute to an automatically generated id (without checking if it is a valid value).

  - otherwise, a dialog box is displayed to let user interactively specify a value (this value is checked for validity).

    This dialog box simply contains a text field if option `[simplePrompt]` has been specified. By default or if option `[normalDialog]` has been specified, this dialog box may contain a more advanced editor, which is specific to the type of the attribute being edited.

Examples:

    putAttribute cols
    putAttribute alt "XMLmind logo"
    putAttribute [implicitElement] cols
    putAttribute [dummy] cols
    putAttribute [implicitElement] [id] xml:id
    putAttribute [simplePrompt] href
    putAttribute [implicitElement] [simplePrompt] href

Prev | Up | Next
63. prompt | Home | 65. recordMacro