Notes on XpressDox syntax

Data element names

a. Data element names must consist only of alpha-numeric characters (A-Z, a-z, 0-9), a full stop, a hyphen and the underscore character(_).
i) A full-stop can be part of the name, as long as it isn’t the first character.
ii) The first character of the data element name must not be a numeric digit.
iii) Data element names are case-sensitive: in other words “Address” and “ADDRESS” refer to two different data elements.
iv) Data element names must match the case of the data element in the data set.

Command names

b. Commands are case insensitive – so ForEach, FOREACH and foreach are all acceptable.
c. The End command which closes off ForEach and If commands is also case insensitive.

Note that the End command is always followed by () to distinguish it from possible data elements named “end”. The text within the two parentheses has no meaning to XpressDox and so can be used to make the context more apparent. For example:
«ForEach(book)»Title: «title»
Author: «author»
«IF(author = "Stephen King")» Be afraid, be very afraid.«End( IF)»«End( foreach book)»

Function calls

d. Function calls can be nested. For more information please see the article on XSLT functions.

Quote marks

e. XpressDox tries to use quote marks as sparingly as possible. Rather, it insists on quote marks in as few places as necessary. Template authors may find this disconcerting to begin with, particularly if they have been using other document assembly products where quote marks are used in many places where XpressDox does not require them.

Quote marks (i.e. “…” or ‘…’ or “…” or ‘…’) need only appear:
i) in the conditional expressions in If and When commands when comparing with a string value, for example «If(Answer = ‘yes’)» but not when comparing with a numeric value, such as in «When(count(Child) > 1,children,child)»;
ii) around formatting parameters passed to functions, for example «FormatNumber(Amount, “#,0.00”)»; or around string literals passed to functions, e.g. «SetV('Name',concat(FirstNames,' ',Surname))»
iii) in GetV and SetV functions around the variable names, and in SaveV (or CreateDataElement) around the variable name as well as the data element name (the latter two functions are the ONLY places where a data element name is enclosed in quotes – this is because before the function executes, the data element being saved/created does not yet exist).

Quotes after Version 2.3.1

With effect from version 2.3.1, it is permissible to enclose string literals in quotes wherever they appear.  In other words, the When command above could also be rendered «When(count(Child) > 1,'children','child')».  The quotes are not a requirement, so existing templates where the commands are used without quotes will continue to work unchanged.

Another example of how this would work is the «ChooseFromRDBList» command which could be «ChooseFromRDBList(Orientation,North,South,East,West)» (old notation) or «ChooseFromRDBList(Orientation,'North','South','East','West')». Note that both of these commands have exactly the same behaviour.

What this means is that if you are confused about whether a string literal should be enclosed in quotes or not, the convention can be used which says “All alphanumeric literals can be in quotes.  Only data element names and numeric constants must not appear in quotes.”

Note that the exceptions are still the SaveV (or CreateDataElement) functions, where the data element name MUST appear in quotes.