-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from OP-TED/efx-2
The work on EFX-2 features is transfered from the efx-2 branch to develop.
- Loading branch information
Showing
14 changed files
with
6,260 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
src/main/resources/templates/xsl_markup/fragment_invocation.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
<#-- | ||
Available variables: | ||
- context: Context path | ||
- name: Content block ID | ||
- name: Content block identifier | ||
- context: Context XPath | ||
- variables: Lits of additional variables (optional) | ||
--> | ||
|
||
<xsl:for-each select="${context}"> | ||
<xsl:call-template name="${name}"/> | ||
<xsl:call-template name="${name}"> | ||
<#list variables as variable> | ||
<xsl:with-param name="${variable[0]}" select = "${variable[1]}" /> | ||
</#list> | ||
</xsl:call-template> | ||
</xsl:for-each> |
28 changes: 22 additions & 6 deletions
28
src/main/resources/templates/xsl_markup/label_from_expression.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
<#-- | ||
Available variables: | ||
- expression: The expression to use for rendering | ||
- labelSuffix: Suffix for labels | ||
- expression: Expression that generates the label key. | ||
- variableSuffix: Suffix provided for uniqueness of variable names. | ||
- quantity: A numeric quantity used to decide if the label needs to be pluralized. | ||
--> | ||
<span class="dynamic-label"> | ||
<xsl:variable name="labels${labelSuffix}" as="xs:string*"> | ||
<#-- | ||
The expression may return a sequence, so we will iterate over each label returned by the expression. | ||
In the process we will collect the labels into a variable. | ||
After we are done iterating, we will join the labels together in a comma separated list. | ||
--> | ||
<xsl:variable name="labels${variableSuffix}" as="xs:string*"> | ||
<xsl:for-each select="${expression}"> | ||
<xsl:variable name="label${labelSuffix}" select="."/> | ||
<xsl:value-of select="($labels//entry[@key=$label${labelSuffix}]/text(), concat('{', $label${labelSuffix}, '}'))[1]"/> | ||
<#if quantity?has_content> | ||
<xsl:variable name="singular${variableSuffix}" select="."/> | ||
<xsl:variable name="plural${variableSuffix}" select="concat(., ted:plural-label-suffix(${quantity}))"/> | ||
<#-- This will fallback to the singual form if a pluralised label does not exist. --> | ||
<#-- If the singular form label does not exist either, then the label key will be shown instead. --> | ||
<xsl:value-of select="($labels//entry[@key=$plural${variableSuffix}]/text(), $labels//entry[@key=$singular${variableSuffix}]/text(), concat('{', $singular${variableSuffix}, '}'))[1]"/> | ||
<#else> | ||
<xsl:variable name="label${variableSuffix}" select="."/> | ||
<#-- If the label does not exist, then the label key is displayed instead. --> | ||
<xsl:value-of select="($labels//entry[@key=$label${variableSuffix}]/text(), concat('{', $label${variableSuffix}, '}'))[1]"/> | ||
</#if> | ||
</xsl:for-each> | ||
</xsl:variable> | ||
<xsl:value-of select="string-join($labels${labelSuffix}, ', ')"/> | ||
|
||
<xsl:value-of select="string-join($labels${variableSuffix}, ', ')"/> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<#-- | ||
Available variables: | ||
- key: The key to use for rendering | ||
- quantity: If pluralisation is required, then this contains the suffix that identifies the plural form of the label. | ||
--> | ||
<span class="label"><xsl:value-of select="($labels//entry[@key=${key}]/text(), concat('{', ${key}, '}'))[1]"/></span> | ||
<#if quantity?has_content> | ||
<xsl:variable name="plural" select="concat(${key}, ted:plural-label-suffix(${quantity}))"/> | ||
<span class="label"><xsl:value-of select="($labels//entry[@key=$plural]/text(), $labels//entry[@key=${key}}]/text(), concat('{', ${key}, '}'))[1]"/></span> | ||
<#else> | ||
<span class="label"><xsl:value-of select="($labels//entry[@key=${key}]/text(), concat('{', ${key}, '}'))[1]"/></span> | ||
</#if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.