Local Export Variables

From version 6.7.1, export variables can be defined locally in layouts. Therefore, the same variable name can be used in several sublayouts without producing name conflicts during the export. In conjunction with the possibility to pass arguments to sublayouts, which also become local variables, layouts can be modularized and therefore are much easier to maintain.

The scope of a local variable is restricted to the layout in which the variable is defined. It is neither visible in the callig parent layouts nor in sublayouts on deeper levels.

In the defining instruction, modifyvar set, a variable can be marked as local by specifying the local attribute and setting its value to true:

<npsobj modifyvar="set" varname="myVar" local="true">
  Contents of the variable
</npsobj>

An existing global variable or local variable with the same name on a higher layout level will always be hidden by a local variable created with modifyvar set.

Local variables work analogously when modifyvar append is used. However, an existing variable, be global or local, will be used for appending the specified context list to it. Thus, with modifyvar append, a variable marked as local will only become local if it needs to be created.