Skip to content

Commit

Permalink
For #309: handle itemset hint in service response
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bruchez committed May 4, 2022
1 parent 6841681 commit 511037f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions form-runner/jvm/src/main/resources/apps/fr/components/actions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -944,24 +944,22 @@
<!-- Should use a version of `XFormsItemUtils.evaluateItemset()`
See https://github.com/orbeon/orbeon-forms/issues/3125 -->
<xsl:variable
name="item-hint-xpath"
select="xs:string(.//(*:variable | *:var)[@name = ('item-hint')]/(@value | @select)[1])"/>
name="item-label"
select=".//(*:variable | *:var)[@name = ('item-label')]/(@value | @select)[1]"/>
<xsl:variable
name="item-value"
select=".//(*:variable | *:var)[@name = ('item-value')]/(@value | @select)[1]"/>
<xsl:variable
name="item-hint"
select=".//(*:variable | *:var)[@name = ('item-hint')]/(@value | @select)[1]"/>
<xf:action iterate="$response-items">

<xsl:variable
name="item-label"
select=".//(*:variable | *:var)[@name = ('item-label')]/(@value | @select)[1]"/>

<xsl:variable
name="item-value"
select=".//(*:variable | *:var)[@name = ('item-value')]/(@value | @select)[1]"/>

<xf:var name="item-label" value="frf:replaceVarReferencesWithFunctionCalls(({$item-label}), ({$item-label}), false(), '{$library-name}')"/>
<xf:var name="item-value" value="frf:replaceVarReferencesWithFunctionCalls(({$item-value}), ({$item-value}), false(), '{$library-name}')"/>
<xf:var name="item-label" value="{frf:replaceVarReferencesWithFunctionCalls($item-label, $item-label, false(), $library-name)}"/>
<xf:var name="item-value" value="{frf:replaceVarReferencesWithFunctionCalls($item-value, $item-value, false(), $library-name)}"/>

<xsl:choose>
<xsl:when test="$item-hint-xpath != ''">
<xf:var name="item-hint" value="{$item-hint-xpath}"/>
<xsl:when test="exists($item-hint) and $item-hint != ''">
<xf:var name="item-hint" value="{frf:replaceVarReferencesWithFunctionCalls($item-hint, $item-hint, false(), $library-name)}"/>
<xf:var name="element-hint" value="xf:element('hint', xs:string($item-hint))"/>
</xsl:when>
<xsl:otherwise>
Expand Down

0 comments on commit 511037f

Please sign in to comment.