# Template Elements and Attributes

This section lists the valid XML elements and attributes that you can use when creating or modifying templates. See the demo templates for examples.

## Conditional Elements

The following table lists the valid conditional elements.

Conditional elements
Element | Description
--- | ---
`<keyview>` | The KeyView XML template container ("root") element
`<if*>` | If the condition from the comparison is true, process the XML. Conditions can be nested up to 25 levels deep. Attributes `name`. (Required) The name of the main item to compare to `item` or `text`. `item`. (Required if no `text`) The name of the item to compare to the item specified by `name`. `text`. (Required if no `item`) The text to compare to the item specified by `name`.
`<ifex>, <ifnx>` | If `name` item exists and has a `text` value or not. The Notes item might have a value that cannot be converted to text, such as an image.
`<ifeq>, <ifne>, <iflt>, <ifle>, <ifgt>, <ifge>` | Respectively, if `text` `==`, `!=`, `<`, `>`, `<=`, `>`, `>=`. Text comparison uses a case-insensitive string compare.
`<iftdeq>, <iftdne>, <iftdlt>, <iftdle>, <iftdgt>, <iftdge>` | Respectively, if time/date `==`, `!=`, `<`, `>`, `<=`, `>`, `>=`. Time/date comparison converts dates to text in local time using the Notes default, `TZFMT_NEVER`, because Notes also sometimes converts fields to text internally. For example:
    text="06/30/2005 02:52:04 PM"
`<iftzeq>, <iftzne>` | Respectively, if the time zone equals or does not equal the comparison `text`, for example `CDT`, `EST`, and so on.
`<ifini>` | If the value of the INI option specified in `name` equals the `text` value.
`<else>` | If the condition from the last `<if>` or `<switch>` was false, process XML.
`<switch>` | If a `name` value exists, process XML. Attributes `name`. (Required) The name of the main item to compare in `<case>` subelements.
`<case>` | If the comparison condition is true, process XML, then stop processing the rest of `<switch>`. Attributes `text`. (Required) The text to compare to the `name` item of `<switch>`.
`<default>` | If all `<case>` conditions were false, process XML. This element must be the last element in `<switch>`, after all the `<case>` elements. Any `<case>` elements after the `<default>` element are ignored.
`<for>` | If a `name` value exists, process XML. Process for each part of the `name` item. Attributes `name`. (Required) The name of the main item. `max`. (Optional) The maximum index to process. By default, all are processed.
`<index>` | Output `<for>` loop index (1-based). `<index>` is only valid within a `<for>` element.

## Control Elements

The following table lists the valid control elements.

Control Elements

Element | Description
--- | ---
`<call>` | Call another XML template. You can nest templates up to 10 levels deep. Attributes `file`. (Required) The template file name. This name must be unique.
`<log>` | Log message to the NSF log file. Attributes `text`. (Required) The text to log. `type`. (Optional) The type of log message. The following values are valid: `ERROR` `WARN` `INFO` `DIAG` (the default option) `DEBUG` `DUMP`
`<quit>` | Stop processing the template. Exits without error. Attributes `text`. (Optional) The text to log. `type`. (Optional) The type of log message. See <log>.
`<stop>` | Stop processing the template. Exits with an `ERROR` log message. Attributes `text`. (Required) The text to log.

## Data Elements

The following table lists the valid data elements.

Data elements

Element | Description
--- | ---
`<text>` | Output text. Attributes `name`. (Required if there is no parent) The name of the item to output.
`<rich>` | Output rich text (MHTML). Images are output in the next part or parts of the MHTML, after the first `<HTML>` part. Attributes `name`. (Required if there is no parent) The name of the item to output.
`<body>` | Output the message body in rich text (MHTML). As with <rich>, images are output in the next part or parts of the MHTML.
`<form>` | Output the message form (usually `$Body` field) in rich text (MHTML). Attributes `name`. (Required if there is no parent) The name of the item to output.
`<addr>` | Output an address. Attributes `name`. (Required if there is no parent) The name of the item to output. `type`. (Optional) The type of address to output. Set this attribute to `CN` (Common Name), which is the only supported type.
`<name>` | Output the name of the last `name` item, or in other words the current main item. The item must exist.
`<format>` | Set the default format for `<date>` and `<date_kv>`. This element does not set the `<text>` format. See Date and Time Formats for a list of all Notes and KeyView date and time formats and integer values. Attributes `format`. (Optional. Omit to reset to defaults) The Notes and KeyView date and time format. You can set the following formats: `TD=``int`. The Time Date format (`TDFMT_*`) `TS=``int`. The Time Show format (`TSFMT_*`) `TT=``int`. The Time Time format (`TTFMT_*`) `TZ=``int`. The Time Zone format (`TZFMT_*`) `KV=``int`. The KeyView date and time format where `int` is an integer value that corresponds to the desired format. Separate multiple formats with commas. For example: `format="TD=0,TS=2,TT=1,TZ=1,KV=55"`
`<date>` | Output a Notes date. Attributes `name`. (Required if there is no parent) The name of the item to output. `format`. (Optional) See <format>. You can set the following values: `TD` `TS` `TT` `TZ`
`<date_kv>` | Output a KeyView date. Attributes `name`. (Required if there is no parent) The name of the item to output. `format`. (Optional) See <format>. You can set the following values: `TZ` `KV`
`<time>` | Output a time range, for example 1 hour, 30 minutes. Attributes `name`. (Required if there is no parent) The item name of the start date or time. `item`. (Required) The item name of the end date or time.
`<zone>` | Output a Notes time zone mnemonic, for example `MST`. Attributes `name`. (Required if there is no parent) The name of date item to output.
`<zone_utc>` | Output a time zone as UTC, for example `(UTC-06:00)`.
`<logo>` | Output the mail header logo. The image link is included in the output; the actual image is output to a different part of the MHTML subfile.
`<image>` | Output an image. The image link is included in the output; the actual image is output to the MHTML next part, as with <rich> and <body>.
`<image_uri>` | Output an image URI, in quotation marks. The actual image is output to a different part of the MHTML subfile. Attributes `link`. (Required if there is no `file`) The image link, such as a form or title name. For example: `link="StdNotesLtr0"` `file`. (Required if there is no `link`) The name of the image file. The file must exist in the `../../templates/images` directory. For example: `file="boxcheck.gif"`

© Copyright 2016-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm