OP-TED / eforms-notice-viewer

This is a sample eForms application that can visualise an eForms notice. It uses efx-toolkit-java to generate XSL templates from notice view templates written in EFX. It then uses an XSLT processor to generate an HTML visualisation of any given eForms notice.
https://docs.ted.europa.eu/eforms-common/notice-viewer/index.html
European Union Public License 1.2
10 stars 2 forks source link

Problem with the translation key #66

Closed skyazid closed 1 year ago

skyazid commented 1 year ago

Description:

I encountered an issue with a translation key used in an XSL file. When the translation key contains a period (e.g. "code|name|selection-criterion.sui-act"), it does not work. However, it works if the translation key does not contain a period (e.g. "business-term|description|BG-1").

Found Solution:

I solved this issue by modifying the label_from_expression.ftl file.

Here’s what I changed:

Before:

<xsl:variable name="label${labelSuffix}" select="."/>

After:

<xsl:variable name="label${labelSuffix}" select="normalize-space(.)"/>

rousso commented 1 year ago

Thanks I will look into this.

rousso commented 1 year ago

Hi @skyazid,

I understand why #{code|name|selection-criterion.sui-act} is a problem. However, I don't understand how the solution you propose solves this problem!

The dots in EFX template label blocks are unfortunately an omission (a bug) of EFX 1. This can only be fixed in EFX 2. The workaround for these label references in EFX 1 is #{code|name|${'selection-criterion.sui-act'}}, and that's how these problems are being avoided in EFX 1.

The normalize(.) in the variable name that you suggest does not make sense to me and more likely hides the problem with some other side effect rather than solves it. I did not try your suggestion to be honest.

I hope this helps, Yannis