SetVariable
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
CopyOf, Element, Paragraph, Table, TextBlock, Until, Value, While
Parent elements
AtPageCreation, AtPageShipout, Case, Contents, ForAll, Function, Layout, Loop, Otherwise, Record, Section, Until, While
Attributes
select(XPath expressions, optional)- The value of the contents.
trace(optional)- Show information about the assignment in the log file.
yes- Show information.
no- Don’t show information (default).
variable(text)- The name of the variable that holds the contents.
Remarks
Variables have global scope.
Example
<Record match="product">
<SetVariable variable="wd" select="5"/>
<PlaceObject>
<TextBlock width="{ $wd }">
<Paragraph>
<Value select="$articlenumber"/>
</Paragraph>
</TextBlock>
</PlaceObject>
</Record>The following example shows a more complex scenario: you can collect complex elements in a variable.
<Record match="products">
<SetVariable variable="articletext"/>
<ProcessNode select="article"/>
<PlaceObject>
<TextBlock>
<Value select=" $articletext "/>
</TextBlock>
</PlaceObject>
</Record>
<Record match="article">
<SetVariable variable="articletext">
<!-- the previous contents is added -->
<Value select="$articletext"/>
<Paragraph>
<Value select=" @description "/>
</Paragraph>
</SetVariable>
</Record>