XT Code - Generate HTML
Embeds an attribute value or the result of a previous operation within text provided by a conversion template which would normally contain HTML code. Values included with the XT code can replace markers in the template.
Input Conversion
Input conversion does not invert: it simply processes the input data.
Syntax
XT;{[DICT || * ]}{file-specifier};template{;{value}}{;{value}}...
Syntax Elements
; A delimiter separating the different parts of the code. This can be any punctuation character that does not appear in any of the parameters.
DICT or * Specifies that the dictionary of the specified file should be used (DICT is preferred).
file-specifier Specifies the file containing an HTML conversion template, in the format:
{/account/}filename{,data-section-name}
If omitted, the current file is assumed.
template The item-id of a file item containing an HTML conversion template.
value A string value to be inserted into the HTML generated by the conversion template in place of a marker code. See Operation.
Operation
The XT code embeds a data value within text provided by a conversion template, substituting parameters included with the XT code for markers in the template. The first two parameters following the XT code specify the file and item containing the conversion template.
A conversion marker has the following format:
<%valueNumber{:defaultValue}%>
where
valueNumber is either the position of a string value following the XT code or 0 for the input data value. Since the first two XT parameters are the file and item containing the conversion template, the third parameter is value number 1, the fourth number 2, etc.
defaultValue is the text to use if the corresponding parameter does not have a value. If specified for parameter number 0 (the input data value), defaultValue is ignored.
Comments
The XT conversion code is intended for use when generating web pages with the GENML and SGENML commands. If used with other English commands the generated HTML will appear in the displayed output.
It recommended that the XT code is placed in attribute 7 of the dictionary definition item.
Examples
-
If item T2 in file HTM contains the following:
<i><%0%></i>
The conversion code
XT;HTM;T2
will enclose the data value in an<i>
tag so that, when displayed in a web browser, it will appear italicised. -
If item T3 in file HTM contains the following:
<span style="text-align: <%1:left%>"><%0%></span>
The conversion code
XT;HTM;T3;right
will generate text that is right aligned when displayed in a web browser. If the valueright
had been omitted, the default value would have been used and the text would have been left aligned.
See also Writing a Conversion Template.