### 37.7 Passing a parameter to a macro

You can pass a single parameter to a macro by enclosing the value of the parameter in parentheses; for examples, see the predefined macros for RTF output listed in Table 37-2. DITA2Go evaluates the parameter as an expression, and the result of the expression is captured in predefined macro variable $$_macroparam. You can reference $$_macroparam in the same macro, and if you need to keep it around, assign its value to another macro variable.

For example, suppose you have a pair of before-and-after macros that surround the body of content intended to be rendered as a note:

    [NoteBefore]
    <p class="notehead"><$$_macroparam></p>
    <p class="notebody">

You could change the heading to reflect the severity level of the note by invoking the macro like this:

    <$NoteBefore("Warning")>

or like this:

    <$NoteBefore("Note")>

Previous Topic: 37.6.8 Removing spaces from strings: an example

Next Topic: 37.8 Debugging macros

Parent Topic: 37. Working with macros

Sibling Topics:

37.1 Defining and invoking macros

37.2 Accessing DITA2Go macro libraries

37.3 Using macro variables

37.4 Using multiple-value list variables

37.5 Accessing settings with configuration macros

37.6 Using expressions in macros

37.8 Debugging macros

37.9 Deploying macros and macro variables

37.10 Using macros to fine-tune HTML or XML output

Table of Contents • Index