Reputation: 359
I have a little problem with an XSL for-each and I can´t find the solution (yes, I know GIYF, I doesn´t help either). That´s the problem. I have this code
<select class="gr">
<xsl:attribute name="style">position:relative; width:350px;</xsl:attribute>
<xsl:attribute name="name">organoDestinatario</xsl:attribute>
<xsl:attribute name="id">organoDestinatario</xsl:attribute>
<option value=""></option>
<xsl:for-each select="$lang.options/option">
<xsl:variable name="lang.temp" select="value"/>
<option value="$lang.temp"><xsl:value-of select="text"/></option>
</xsl:for-each>
</select>
It seems to be right but, when I look into the option variable value, what I see is $lang.temp, so It´s not catching the value of $lang.temp but the name of the variable. Weird thing is that "text" is working and, If I change it to "value", It works and shows the value. So I´m sure that everything is "filled".
Any advice about It? I really don´t know What´s going on here. Any Help will be appreciated.
Upvotes: 0
Views: 79
Reputation: 122374
You need to use an attribute value template
<option value="{$lang.temp}">
or just drop the variable altogether and say
<option value="{value}">
Any parts of a literal attribute value that you want to be interpreted as XPath expressions need to be wrapped in braces. Anything not in braces is rendered literally.
Upvotes: 1