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

## 54. putAttribute

Parameter syntax:

    [ '[implicitElement]' ]? [ '[empty]'|'[none]'|'[id]' ]? 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).

Examples:

    putAttribute [implicitElement] cols
    putAttribute linkend "chapter 1"
    putAttribute [dummy] cols
    putAttribute [implicitElement] [dummy] cols

Prev | Up | Next
53. prompt | Home | 55. recordMacro