Associates a value with a variable name. The value can be a simple value or a more complex one consisting of several elements.

Child elements

Attribute, Column, Columns, Copy-of, Element, ForAll, Loop, Paragraph, SortSequence, Switch, Table, TableNewPage, Tablehead, Tablerule, Td, Tr, Value

Parent elements

AtPageCreation, Layout, Loop, While


select (XPath expression, optional)

The value of the contents.

trace (optional)

Show information about the assignment in the log file.


Show information.


Don’t show information (default).

variable (text)

The name of the variable that holds the contents.


Variables have global scope.


<Record element="product">
  <SetVariable variable="wd" select="5"/>
    <Textblock width="{ $wd }">
        <Value select="$articlenumber"/>

The following example shows a more complex scenario: you can collect complex elements in a variable.

<Record element="products">
  <SetVariable variable="articletext"/>
  <ProcessNode select="article"/>
      <Value select=" $articletext "/>

<Record element="article">
  <SetVariable variable="articletext">
    <!-- the previous contents is added -->
    <Value select="$articletext"/>
      <Value select=" @description "/>

See also

The section Programming