This syntax works in BetterForm+eXist:
<xf:label>
<xf:output value="concat(LastName, ',', FirstName)" />
</xf:label>
Pergunta
I have an instance with a list of artists
<xf:instance id="Artists" xmlns="">
<Artists>
<Artist ID="6548">
<FirstName>Elvis</FirstName>
<LastName>Presley</LastName>
</Artist>
<Artist ID="7895">
<FirstName>Duane</FirstName>
<LastName>Eddy</LastName>
</Artist>
</Artists>
</xf:instance>
And I want to select Artists from the list. This code:
<xf:select>
<xf:label>Artists</xf:label>
<xf:itemset nodeset="instance('Artists')/Artist">
<xf:label ref="LastName" ></xf:label>
<xf:value ref="@ID"></xf:value>
</xf:itemset>
</xf:select>
Shows "Presley" and "Eddy" labels, but I would like to show "Presley, Elvis" and "Eddy, Duane". Can this be done without modifying the model? I suppose there is some way to put an expression there, but I don't know.
I tried:
<xf:label ref="concat(LastName, ',', FirstName)" ></xf:label>
But that just does not show anything. (I am using BetterForm and eXist)
Solução 2
This syntax works in BetterForm+eXist:
<xf:label>
<xf:output value="concat(LastName, ',', FirstName)" />
</xf:label>
Outras dicas
Try this:
<xf:label value="concat(LastName, ', ', FirstName)" />
This solution may be implementation-specific, i've tested it only with orbeon forms. The sole difference to your code is the value
attribute in the xf:label
element instead of @ref
. ref="concat(LastName, ',', FirstName)"
won't work since with ref
, you specify a singe-node binding. If there's no such node in the model, it will fail. With value
instead, you can create a "computed" label value, using XPath.