Sections

A template file groups its template lines in sections. Each section starts with a header: a line between hyphens.

  • Template sections declare callable templates.

  • The main section describes the full display of the notice.

  • A header section, a summary section and a navigation section can describe three more views of the same notice: its header, a summary, and aids to move around it.

The sections come in this order: the template sections, the main section, then the header, summary and navigation sections, in any order.

Template section

A template section declares a callable template: template content with a name and parameters, which template lines display with INVOKE. So you write the content once, and display it in several places.

Syntax
--- TEMPLATE <template-name> ---
LET <parameter>, <parameter>, …;
<template-line>
…
<template-name>

the name of the callable template: letters and digits, starting with a letter, in parts that can be separated by single hyphens, such as labelled-value (see Identifiers).

LET

optional. The line that declares the parameters of the template, directly after the header. Without it, the template has no parameters.

<parameter>

a parameter, written <type>:$<parameter-name>, with the types of the parameters of a user-defined function, such as text:$label or text*:$values.

<template-line>

one or more template lines: the content of the template (see Template line).

The header is a line of its own: at least three hyphens, the keyword TEMPLATE, the name of the template, and at least three hyphens. A comment can follow it. Template sections come after the global declarations and before the main section. The main section must then start with its header, --- MAIN --- (see Main section). A template file can have any number of template sections.

You write the template lines of the section as in the main section. The first one is not indented, and you can nest the others under it with indentation. Each line can have an outline marker, a context declaration, a conditional display or an INVOKE. Each time a line invokes the template, EFX displays all the lines of the template, in order, in the place of that line (see Template invocation).

When a template line invokes the template, the arguments of the invocation give the values of the parameters (see Template invocation). In the lines of the section, you refer to the parameters as variables, $<parameter-name>. The lines can also use the global variables, dictionaries and user-defined functions, but not the variables of the template line that invokes the template.

EFX displays a template line of the section without a context declaration once each time the template is invoked. It reads the field and node references of the section from the root of the notice, whatever the context of the line that invokes the template. So a line with WITH BT-00-Text is displayed for each occurrence of BT-00-Text in the whole notice. You must pass the values that depend on the context of the invoking line as arguments.

A template can invoke the templates of the sections before its own. It cannot invoke itself, directly or through other templates, and it cannot invoke a template declared in a later section.

Restrictions

  • A template section contains at least one template line, and its first line is not indented.

  • The LET line of the parameters comes directly after the header, before the first template line.

  • Apart from the LET line of its parameters, a template section contains template lines only: no global declarations and no include directives.

  • No template section can come after the main section.

  • Two templates cannot have the same name, and a template cannot have the name of a variable, a dictionary or a user-defined function of the file.

  • The name of a template cannot be a keyword of expressions, such as date, text or count, because an invocation could not name it.

  • The translator gives each template line a name made of its section and its number: body01 for the first line of the main section, t01 for the first line of a template t. A template cannot have a name that the translator gives to a line, such as body01, or t01 when a template t has more than one line.

Examples

--- TEMPLATE labelled-value ---
LET text:$field-id, text:$value;
DISPLAY #{field|name|${$field-id}}: ${$value};
--- MAIN ---
WITH BT-00-Text INVOKE labelled-value('BT-00-Text', BT-00-Text);
WITH BT-00-Code INVOKE labelled-value('BT-00-Code', BT-00-Code);

A template that displays the name of a field and a value, invoked for two fields.

--- TEMPLATE size ---
LET number:$n;
WHEN $n > 100 DISPLAY large
WHEN $n > 10 DISPLAY medium
OTHERWISE DISPLAY small;
--- MAIN ---
WITH BT-00-Number DISPLAY #{name}: $value;
	WITH BT-00-Number INVOKE size(BT-00-Number);

A template with conditional content.

--- TEMPLATE texts ---
LET text*:$values;
DISPLAY ${count($values)} texts: ${$values};
--- TEMPLATE all-texts ---
INVOKE texts(BT-00-Repeatable-Text);
--- MAIN ---
WITH ND-Root INVOKE all-texts();

A template with a sequence parameter, invoked by a template of a later section.

--- TEMPLATE sub-node ---
DISPLAY #{name|BT-00-Text}: ${BT-00-Text};
	WITH BT-01-SubNode-Text DISPLAY #{name}: $value;
--- MAIN ---
WITH ND-SubNode INVOKE sub-node();

A template of two lines, the second nested under the first.

From the SDK (view-templates/1.efx)
--- TEMPLATE currency-value ---
LET text:$field-pred, text:$field;
DISPLAY #{field|name|${$field}}: ${format-number(number($field-pred), '###,##0.##')};
Callable templates are new in EFX-2.

See also: Template line

Main section

The main section holds the template lines that describe the full display of the notice.

Syntax
--- MAIN ---
<template-line>
…
<template-line>

zero or more template lines (see Template line).

The header is a line of its own: at least three hyphens, the keyword MAIN, and at least three hyphens. A comment can follow it. When the template file has template sections, the main section comes after them and must start with this header. Without template sections, the header is optional: the template lines that follow the global declarations form the main section.

The main section comes before the header, summary and navigation sections. The indentation of its template lines starts at the top level, and their outline numbers start from 1.

Restrictions

  • A template file has at most one main section header.

  • No declaration can follow the header: declarations come at the start of the file.

Examples

--- TEMPLATE t ---
DISPLAY t;
--- MAIN ---
INVOKE t();
--- SUMMARY ---
INVOKE t();

A template section, the main section and a summary section.

DISPLAY x;

A template file without template sections: you can leave out the header of the main section.

In EFX-1, a template file contained only the template lines of the main section, without a header.

See also: Template file

Header section

The header section describes the header of the notice: the parts that identify the notice at the top of its display, such as its heading, its title, its type and the date of its publication.

Syntax
--- HEADER ---
#HEADING <heading-display>;
#SUBHEADING <heading-display>;
#TITLE <normal-display>;
#COUNTRY <normal-display>;
#MAIN-CLASSIFICATION <normal-display>;
#MAIN-NATURE <normal-display>;
#FORM-TYPE <normal-display>;
#NOTICE-TYPE <normal-display>;
#PUBLICATION-NUMBER <normal-display>;
#OJ-ISSUE <normal-display>;
#PUBLICATION-DATE <normal-display>;
<normal-line>
…
#HEADING, …, #PUBLICATION-DATE

optional: the names of the eleven parts of the header. Each name starts a line that displays that part. You write these lines in the order of the syntax, each at most once.

<heading-display>

what the part displays: DISPLAY and a template, or a conditional display, with an optional WITH and a context declaration before it. You write it as in a heading, so a colon in it is text (see Heading).

<normal-display>

the same, written as in a normal line. A colon can separate a caption from the content (see Caption).

<normal-line>

optional, any number: normal lines, which can have normal lines nested under them (see Template line).

The section header is a line that starts with at least three hyphens, followed by the keyword HEADER and by at least three hyphens. Spaces or tabs can separate the keyword from the hyphens, and a comment can follow the header.

The section follows the main section. The header, summary and navigation sections can come in any order.

Each part has a fixed name, so that the application that displays the notice knows what the part shows, and can place it. The names stand for this content:

Part Content

#HEADING

the heading of the display

#SUBHEADING

a line under the heading

#TITLE

the title of the notice

#COUNTRY

a country, such as the country of the buyer

#MAIN-CLASSIFICATION

the main classification of the procurement

#MAIN-NATURE

the main nature of the contract

#FORM-TYPE

the form type of the notice

#NOTICE-TYPE

the notice type

#PUBLICATION-NUMBER

the publication number of the notice

#OJ-ISSUE

the issue of the Official Journal in which the notice is published

#PUBLICATION-DATE

the date of publication of the notice

The template translator does not check what a part displays: you choose the template that gives the content of each part.

A line of a part is a template line at the top level. With WITH, EFX displays it once for each occurrence that its context matches. Without WITH, EFX displays it once. When the line displays nothing, for example because its context matches nothing, the header shows nothing for that part.

The normal lines that follow the parts display more information for the header. You write them as in the rest of the file, with indentation to nest them.

The template lines of the section can use the global variables, dictionaries and user-defined functions of the file. The template translator keeps the header separate from the full view. The application that displays the notice decides where and how to show each part and each line.

Restrictions

  • You write the keyword HEADER in upper case, and the header starts at the beginning of the line.

  • A template file can contain only one header section.

  • The lines of the parts come in the order of the syntax, each at most once, before the normal lines of the section.

  • You write the names of the parts in upper case, at the beginning of the line: a line of a part has no indentation, and no line can be nested under it.

  • A line of a part displays its content with DISPLAY or with a conditional display. It cannot invoke a callable template.

  • After the parts, the section contains normal lines only. A heading, a bulleted line, or a line that invokes a callable template, is an error.

  • You can write the names of the parts only in the header section.

  • The section contains template lines only. You must write declarations at the start of the file.

Examples

WITH BT-00-Text DISPLAY #{name}: $value;
--- HEADER ---
#HEADING DISPLAY Notice ${BT-00-Text};
#TITLE WITH BT-00-Text DISPLAY #{name}: $value;
#NOTICE-TYPE WITH BT-00-Code DISPLAY #{name}: $value;
DISPLAY #{name|BT-00-Number}: ${BT-00-Number};
	WITH BT-00-Indicator DISPLAY #{name}: $value;

A header with three parts and a normal line. The title and the notice type have a caption, the name of their field. The normal line has a line nested under it.

WITH BT-00-Text DISPLAY a;
--- HEADER ---
#HEADING DISPLAY Notice: ${BT-00-Text};
#SUBHEADING WHEN BT-00-Number > 100 DISPLAY Large OTHERWISE DISPLAY Small;

The heading displays its colon as text. The subheading depends on a condition.

WITH BT-00-Text DISPLAY #{name}: $value;
--- SUMMARY ---
WITH BT-00-Text DISPLAY $value;
--- HEADER ---
#TITLE WITH BT-00-Text DISPLAY $value;

A header section after a summary section.

The header section is new in EFX-2.

See also: Template file

Summary section

The summary section describes a short view of the notice, which the application can display besides the full view.

Syntax
--- SUMMARY ---
<template-line>
…
<template-line>

optional, any number: see Template line.

The section header is a line that starts with at least three hyphens, followed by the keyword SUMMARY and by at least three hyphens. Spaces or tabs can separate the keyword from the hyphens, and a comment can follow the header.

The section follows the main section. The header, summary and navigation sections can come in any order.

You write the template lines of the section as in the rest of the file. Indentation starts again at the top level, and the outline numbers start again from 1. The template lines can use the global variables, dictionaries, user-defined functions and callable templates of the file.

The template translator keeps the summary separate from the full view. The application that displays the notice decides where and how to show the summary.

Restrictions

  • You write the keyword SUMMARY in upper case, and the header starts at the beginning of the line.

  • A template file can contain only one summary section.

  • The section contains template lines only. You must write declarations at the start of the file.

  • The first template line of the section cannot be indented.

Examples

1 WITH ND-Root DISPLAY #{auxiliary|text|notice-information};
	WITH BT-00-Text DISPLAY #{name}: $value;
	WITH BT-00-Number DISPLAY #{name}: $value;
--- SUMMARY ---
WITH BT-00-Text DISPLAY $value;

The full view shows a heading with two values. The summary shows one value.

--- TEMPLATE short-text ---
LET text:$t;
DISPLAY ${substring($t, 1, 20)};
--- MAIN ---
WITH BT-00-Text DISPLAY #{name}: $value;
---- SUMMARY ----
WITH BT-00-Text INVOKE short-text(BT-00-Text);
------ NAVIGATION ------
DISPLAY #{auxiliary|text|notice-information}@{'#notice-information'};

A summary that invokes the template of a template section. The headers can have more than three hyphens.

The summary section is new in EFX-2.

See also: Template file

Navigation section

The navigation section describes aids to move around the displayed notice, such as a table of contents with links to its main parts.

Syntax
--- NAVIGATION ---
<template-line>
…
<template-line>

optional, any number: see Template line.

The section header is a line that starts with at least three hyphens, followed by the keyword NAVIGATION and by at least three hyphens. Spaces or tabs can separate the keyword from the hyphens, and a comment can follow the header.

The section follows the main section. The header, summary and navigation sections can come in any order.

You write the template lines of the section as in the rest of the file, with their own indentation and outline markers. They can use the declarations at the start of the file.

A heading of the navigation section is a navigation entry. It links to the heading of the main section that has the same navigation address and is displayed for the same occurrence in the notice. What the entry displays, with its number, becomes the text of the link.

The navigation address is made of the outline numbers and tags of the heading, and of the headings that it is nested in (see Heading). Tags name the heading to link to: #notice-info in the navigation section links to #notice-info in the main section. The heading of the main section can also be in a callable template that the main section invokes.

Give the entry the same context as its heading, as in the first example below. An entry displayed for another occurrence links to nothing. The template translator checks that the address exists, but it cannot check that the occurrence is the same.

EFX displays the normal lines of the navigation section as they are, without a link. Hyperlinks in normal lines can refer to other parts of the displayed notice (see Hyperlink).

The template translator keeps the navigation section separate from the full view. The application that displays the notice decides where and how to show it.

Restrictions

  • You write the keyword NAVIGATION in upper case, and the header starts at the beginning of the line.

  • A template file can contain only one navigation section.

  • The section contains template lines only. You must write declarations at the start of the file.

  • The first template line of the section cannot be indented.

  • A heading of the navigation section needs an outline number or a tag. A heading marked with # alone names no heading to link to.

  • The main section, or a callable template that it invokes, must have a heading with the navigation address of each heading of the navigation section.

  • A heading of the navigation section cannot contain a hyperlink block, because what it displays is already the link to its heading.

Examples

#notice-info DISPLAY #{auxiliary|text|notice-information};
	WITH BT-00-Text DISPLAY #{name}: $value;
1 WITH ND-SubNode DISPLAY Sub-node;
	#text WITH BT-01-SubNode-Text DISPLAY #{name};
--- NAVIGATION ---
#notice-info DISPLAY #{auxiliary|text|notice-information};
1 WITH ND-SubNode DISPLAY Sub-node;
	#text WITH BT-01-SubNode-Text DISPLAY Text;

Three navigation entries, displayed for the same occurrences as their headings. They link to the headings with the navigation addresses notice-info, 1 and 1_text: one entry for each sub-node, and one for each of its texts.

? DISPLAY A;
	WITH BT-00-Text DISPLAY x;
? DISPLAY B;
	WITH BT-00-Text DISPLAY y;
--- NAVIGATION ---
2 DISPLAY B;

The navigation entry 2 links to the second heading, which ? has numbered 2.

1 WITH ND-Root DISPLAY #{auxiliary|text|notice-information};
	WITH BT-00-Text DISPLAY #{name}: $value;
--- NAVIGATION --- // links to the parts of the notice
1 DISPLAY #{auxiliary|text|notice-information};
--- SUMMARY ---
1 WITH ND-Root DISPLAY Summary;
	WITH BT-00-Text DISPLAY $value;

A navigation section followed by a summary section. The outline numbering of the summary starts again from 1.

LET text:$title = 'Title';
WITH BT-00-Text DISPLAY #{name}: $value;
--- NAVIGATION ---
DISPLAY ${$title}@{'#title'};

A global variable used in the navigation section.

The navigation section is new in EFX-2.

See also: Template file