Notice View Templates
To standardise the way a notice can be visualised, independently of the media format used (PDF, HTML etc.), we have decided to create and share with our developer community a set of "view templates".
Every notice subtype can be associated with one or more different view templates. These templates are available in the view-templates
folder in the eForms SDK. To create these template files, we use the EFX template language.
View templates
The view templates are available in the view-templates
folder of the SDK and have the extension .efx
.
The file named view-templates.json
provides information on each view template.
{
"ublVersion" : "2.3", (1)
"sdkVersion" : "1.0.0", (2)
"metadataDatabase" : { (3)
"version" : "1.0.0",
"createdOn" : "2022-08-05T10:24:40"
},
"viewTemplates" : [
{
"id" : "1", (4)
"filename" : "1.efx", (5)
"description" : "Default", (6)
"_noticeSubtypeIds" : [ "1" ], (7)
"_label" : "view|name|1" (8)
},
...
]
}
1 | Version of the UBL standard used. |
2 | Version of the eForms SDK the file belongs to. |
3 | Version number and date of the data used to create this file. |
4 | Identifier of the view template. |
5 | Name of the file containing the view template. |
6 | Description of the view template. |
7 | List of the notice subtypes that can be visualised with this view template. |
8 | Identifier of the label for the name of the view template. The label is available in the translations folder. |
For this version of the eForms SDK there is only one template available for every notice subtype. In addition, there is a summary
template that can be used for any notice subtype, and, as the name implies, it generates a summarised view of the notice.
Template language syntax
As the .efx
file extension implies, the language used to write the template is EFX.
EFX, short for "eForms expression language", is a domain specific language that we have developed to allow us to easily and unambiguously express the eForms business rules, as well as to enable us to define these view templates. EFX templates provide the structural information necessary to visualise the notice. The template uses EFX expressions to convey content information.
For details on the EFX template language syntax follow this link.
How to reuse the templates
If you could take advantage of these view templates to automatically visualise any notice, you would avoid having to recode your hardcoded visualisations every time a new version of eForms is released. Moreover, you could even aim at reusing the same template system for the visualisation of notices tailored for you Member State. So how can that be achieved?
The general idea is that you would need to automatically translate the eForms view templates to the templating system of your choice. Then use the automatically generated templates to visualise any notice.
For details on how to translate the provided EFX templates to the template language of your choice, see Transpiling EFX.
See also: