String transformations

It is possible to apply a simple string transformation to the value assigned to a variable by using the transform attribute. An attempt to transform content with structure (tags or custom markers) will be ignored and produce a warning.

The following transformations are defined:

  • UPPER — if present, the string assigned to the variable is transformed to upper case characters.

  • LOWER — if present, the string assigned to the variable is transformed to lower case characters.

  • ALPHA — if present, the resolved numerical value assigned to the variable is transformed to a character string in the sequence a,b,c, ... z,aa,ab,ac, .... You can use this transformation to generate an alpha label for a list item paragraph. This transformation is only valid for integers greater than zero.

  • ROMAN — if present, the resolved numerical value assigned to the variable is transformed to a roman-numeral string. You can use this transformation to generate a roman numeral label for a list item paragraph.

  • INDIC — if present, the resolved numerical value assigned to the variable is transformed to an Arabic-Indic numeral string. You can use this transformation to generate an Arabic-Indic numeral label for a list item paragraph.

  • EASTERN-INDIC — if present, the resolved numerical value assigned to the variable is transformed to an Eastern Arabic-Indic numeral string. You can use this transformation to generate an Eastern Arabic-Indic numeral label for a list item paragraph.

  • TRIM — if present, all leading and trailing whitespace is removed from the string assigned to the variable.

  • NORM — if present, all sequences of whitespace in the string are normalized to a single space.

  • BASENAME — if present, and the declared string is a filename path, then the string assigned to the variable is the base file name (excluding the folder path). You can use this if you need to map a hard coded filename to a different folder.

  • FOLDERPATH — if present, and the declared string is a filename path, then the string assigned to the variable is the folder name (excluding the base file name). You can use this if you need to map a hard coded filename to a different folder.

  • LEVELNAME — if present, and the declared string is a TopLeaf repository level or partition name, then the string assigned to the variable is formatted as per the TopLeaf GUI repository level name conventions.

  • PERCENT-ENCODE — if present, then the string assigned to the variable is percent-encoded. You can apply this transform when you need to create a valid user variable name using the content of the assigned variable. For example:

    <set var="MyName" string="XYZ Carbon" transform="PERCENT-ENCODE" />

    assigns the string XYZ%20Carbon to the specified user variable.

You can specify more than one transformation in a single variable assignment. The following example shows how to assign an upper case roman numeral to a variable:

<set var="Double" value="12" transform="ROMAN,UPPER" />
[Note] Note

  • It is not possible to specify UPPER and LOWER within the same variable assignment

  • It is not possible to specify BASENAME and FOLDERPATH within the same variable assignment

  • The transform ALPHA-LEGACY can be used to produce the sequence a,b,c, ... z,za,zb,zc, ... used by some legacy jobs. Its use in new jobs is not recommended.