Changes from EFX-1

EFX-2 extends EFX-1 with many new parts of the language, and with a new flavour, EFX Rules. In a few places, it also changes EFX-1, to make the language more precise and to find more errors. In those places, you must adapt an expression or a template written for EFX-1 before you can use it with EFX-2. This appendix lists these changes first, then the one EFX-1 name that EFX-2 still accepts, then what is new. Each item links to the entries that describe it.

Changes that require EFX-1 expressions to be adapted

Sequences in square brackets

You write a sequence of values as ['a', 'b'], no longer as ('a', 'b'). See Sequence construction.

Codelist references

You refer to a codelist as [...main-activity], no longer as (main-activity) or #main-activity. See Codelist reference.

No type name before a reference

In EFX-1, you could state the type of a reference before it, as in number:BT-00-Number. EFX-2 does not need this, because the translator finds the type of every reference by itself: write BT-00-Number. See Type checking.

The type measure is now duration

The type name is duration in the declarations of variables and parameters, and in iterators. The functions add-measure and subtract-measure are now add-duration and subtract-duration. See Duration.

Context overrides after a context variable only

Only a context variable can come before ::: $n::BT-21-Number. EFX-1 also accepted a field or a node there, as in ND-RepeatableNode::BT-21-Number. You now write such a reference with an iteration or a context variable. See Context override.

Single expressions and template lines without braces

You now write:

  • a single expression as WITH <context> COMPUTE <expression>, no longer as {<context>} ${<expression>};

  • a selector as WITH <context> SELECT <selection>, no longer as {<context>} &{<selection>};

  • a template line as WITH <context> DISPLAY <template>;, no longer as {<context>} <template>.

Outline numbers

A template line without a number no longer receives one automatically. Write ? at the start of a template line that relied on an automatic number, and remove the 0 of a template line without a number: 0 is no longer accepted. See Heading.

XPath axes removed

References such as preceding::BT-… are no longer accepted. See Field reference.

References to other notices removed

References of the form notice(…)/BT-… are no longer accepted. Rules files receive information from other notices through dynamic functions. See Dynamic function declaration.

Text-multilingual fields

A reference to a text-multilingual field gives the texts in all its languages, as a sequence. EFX-1 templates displayed the text in the preferred language automatically. In EFX-2, you select the language yourself. See Preferred language property.

Meaning of is empty

In EFX-1, X is empty was true when the text X was empty. In EFX-2, it is true when X has no value, for example when the field is absent. For the EFX-1 meaning, you now write empty(X). See Emptiness and empty.

Fields with multiple values

You cannot compare a reference that can give several values as a single value. EFX-1 accepted BT-13-Text == 'a', which was true as soon as one of the values matched. Because of this, mistakes could remain unnoticed, so EFX-2 reports such a comparison as an error. Write 'a' in BT-13-Text instead, or use a quantified expression. See Type checking and Quantified expression.

Regular expressions

The patterns of like and replace-regex can use only the parts of regular expressions that work in the same way in all target languages, and the translator checks them. See Regular expressions.

Special characters and words in template text

In the text of a template line, the characters @, &, \ and ; have a special meaning. The words WHEN, OTHERWISE and INVOKE, in upper case and after a space, are keywords. See Text.

Colons in template text

In a template line that is not a heading, the first colon separates a caption from the content, and EFX does not display it. For a colon that EFX must display, write \:, as in https\://example.com. Apart from colons written in this way, a template that is not a heading can contain only one colon. See Caption.

Grouping of operators

The conditions, such as in and like, apply before the comparisons, and EFX reads every level of operators from the left. If an expression relies on another grouping, you must add parentheses. See Parentheses and precedence.

Square brackets

A number in square brackets after a reference is not a position: square brackets without at hold a condition. To select one value by its position, use an index, [at 1]. See Index.

Functions

You can use format-number only in templates, and you must give its picture. sequence-equal requires two sequences of the same type. text gives numbers in a standard form that can differ from the EFX-1 output.

EFX-1 name still accepted

EFX-2 still accepts one EFX-1 name, to make the move from EFX-1 easier: the function name string, another name for text. In new expressions, use text.

New in EFX-2

EFX Expressions
  • the WITH … COMPUTE form of a single expression, and selectors (WITH … SELECT), which return the occurrences that a reference points to (see Expression forms);

  • types found by the translator for every part of an expression, and any single value accepted where a sequence is expected (see Type checking);

  • variables: declarations with LET, variables in context declarations, sequence types, context variables and dynamic variables (see Variables);

  • node references in presence conditions and in count, several predicates after a reference, context overrides followed by a node, and the field properties, such as :rawValue, :privacyCode or :publicationDate (see References);

  • the conditions has duplicates and has no duplicates, is unique in for any single value and sequence, and the addition and subtraction of a duration to and from a date (see Operators);

  • indexes ([at n]), iterations that return sequences, and distinct (see Sequences and iteration);

  • calls of user-defined and dynamic functions (see Function calls);

  • many new built-in functions, and conversions extended to more types (see Built-in functions);

  • comments in expressions and rules files, and statement keywords written in upper case (see Lexical structure).

EFX Templates
  • global declarations at the start of a template file: variables, dictionaries and user-defined functions; template sections, which declare callable templates before the main section; a header section, a summary section and a navigation section after the main section; and include directives (see Template file and Sections);

  • the template line form WITH <context> DISPLAY <template>;, variables in the context declaration, conditional display with WHEN and OTHERWISE, template invocation with INVOKE, and bulleted lines (see Template lines);

  • in the content of a line: the formatting of values by type and the format options of expression blocks, line breaks, line joining, hyperlinks, character references, escape sequences, computed label identifiers and the pluraliser (see Template content).

EFX Rules

The whole flavour is new. SDK 1 delivered the validation rules as Schematron files, and used EFX-1 expressions for validation only in the constraints of the field metadata. In EFX-2, you write rules in rules files, with validation stages, rule-sets, WITH EVERY and rules (see Rules file). Semantic assertions state what a rule requires of a field, in a form that client applications can use to prevent mistakes while the user enters the data (see Semantic assertion). Rule identifiers have the form R-XXX-XXX instead of the form BR-… used in SDK 1.