|
28 | 28 | import eu.europa.ted.efx.model.Expression;
|
29 | 29 | import eu.europa.ted.efx.model.Expression.PathExpression;
|
30 | 30 | import eu.europa.ted.efx.model.Expression.StringExpression;
|
| 31 | +import eu.europa.ted.efx.model.Expression.StringListExpression; |
31 | 32 | import eu.europa.ted.efx.model.Markup;
|
32 | 33 | import eu.europa.ted.efx.sdk1.EfxParser.*;
|
33 | 34 | import eu.europa.ted.efx.xpath.XPathAttributeLocator;
|
@@ -276,33 +277,45 @@ private void shorthandIndirectLabelReference(final String fieldId) {
|
276 | 277 | final Context currentContext = this.efxContext.peek();
|
277 | 278 | final String fieldType = this.symbols.getTypeOfField(fieldId);
|
278 | 279 | final XPathAttributeLocator parsedPath = XPathAttributeLocator.findAttribute(symbols.getAbsolutePathOfField(fieldId));
|
279 |
| - final StringExpression valueReference = parsedPath.hasAttribute() |
280 |
| - ? this.script.composeFieldAttributeReference(symbols.getRelativePath(parsedPath.getPath(), currentContext.absolutePath()) , |
281 |
| - parsedPath.getAttribute(), StringExpression.class) |
282 |
| - : this.script.composeFieldValueReference(symbols.getRelativePathOfField(fieldId, currentContext.absolutePath()), StringExpression.class); |
| 280 | + final PathExpression valueReference = parsedPath.hasAttribute() |
| 281 | + ? this.script.composeFieldAttributeReference( |
| 282 | + symbols.getRelativePath(parsedPath.getPath(), currentContext.absolutePath()), |
| 283 | + parsedPath.getAttribute(), PathExpression.class) |
| 284 | + : this.script.composeFieldValueReference( |
| 285 | + symbols.getRelativePathOfField(fieldId, currentContext.absolutePath()), |
| 286 | + PathExpression.class); |
| 287 | + final String loopVariableName = "$item"; |
283 | 288 |
|
284 | 289 | switch (fieldType) {
|
285 | 290 | case "indicator":
|
286 |
| - this.stack |
287 |
| - .push(this.markup.renderLabelFromExpression(this.script.composeStringConcatenation( |
| 291 | + this.stack.push(this.markup.renderLabelFromExpression(this.script.composeForExpression( |
| 292 | + this.script.composeIteratorList( |
| 293 | + List.of(this.script.composeIteratorExpression(loopVariableName, valueReference))), |
| 294 | + this.script.composeStringConcatenation( |
288 | 295 | List.of(this.script.getStringLiteralFromUnquotedString(ASSET_TYPE_INDICATOR),
|
289 | 296 | this.script.getStringLiteralFromUnquotedString("|"),
|
290 | 297 | this.script.getStringLiteralFromUnquotedString(LABEL_TYPE_WHEN),
|
291 |
| - this.script.getStringLiteralFromUnquotedString("-"), valueReference, |
| 298 | + this.script.getStringLiteralFromUnquotedString("-"), |
| 299 | + this.script.composeVariableReference(loopVariableName, StringExpression.class), |
292 | 300 | this.script.getStringLiteralFromUnquotedString("|"),
|
293 |
| - this.script.getStringLiteralFromUnquotedString(fieldId))))); |
| 301 | + this.script.getStringLiteralFromUnquotedString(fieldId))), |
| 302 | + StringListExpression.class))); |
294 | 303 | break;
|
295 | 304 | case "code":
|
296 | 305 | case "internal-code":
|
297 |
| - this.stack |
298 |
| - .push(this.markup.renderLabelFromExpression(this.script.composeStringConcatenation( |
299 |
| - List.of(this.script.getStringLiteralFromUnquotedString(ASSET_TYPE_CODE), |
300 |
| - this.script.getStringLiteralFromUnquotedString("|"), |
301 |
| - this.script.getStringLiteralFromUnquotedString(LABEL_TYPE_NAME), |
302 |
| - this.script.getStringLiteralFromUnquotedString("|"), |
303 |
| - this.script.getStringLiteralFromUnquotedString( |
304 |
| - this.symbols.getRootCodelistOfField(fieldId)), |
305 |
| - this.script.getStringLiteralFromUnquotedString("."), valueReference)))); |
| 306 | + this.stack.push(this.markup.renderLabelFromExpression(this.script.composeForExpression( |
| 307 | + this.script.composeIteratorList( |
| 308 | + List.of(this.script.composeIteratorExpression(loopVariableName, valueReference))), |
| 309 | + this.script.composeStringConcatenation(List.of( |
| 310 | + this.script.getStringLiteralFromUnquotedString(ASSET_TYPE_CODE), |
| 311 | + this.script.getStringLiteralFromUnquotedString("|"), |
| 312 | + this.script.getStringLiteralFromUnquotedString(LABEL_TYPE_NAME), |
| 313 | + this.script.getStringLiteralFromUnquotedString("|"), |
| 314 | + this.script.getStringLiteralFromUnquotedString( |
| 315 | + this.symbols.getRootCodelistOfField(fieldId)), |
| 316 | + this.script.getStringLiteralFromUnquotedString("."), |
| 317 | + this.script.composeVariableReference(loopVariableName, StringExpression.class))), |
| 318 | + StringListExpression.class))); |
306 | 319 | break;
|
307 | 320 | default:
|
308 | 321 | throw new ParseCancellationException(String.format(
|
|
0 commit comments