> <a href="[EMAIL PROTECTED]" class="page">
>
> Means "generate an a and set its href attribute to the value of the
> href attribute of the current node".
>
> {} is the equivalent of "xsl:value-of select.." for attributes.
OK thanks. I didn't know this XSLT syntax but I've just checked in my
XSLT bible and it's very well explained. I must have skipped this
paragraph the first time I read it ;-)
So now I understand that syntax, knowing that @href is given a value
like "?locale=fr_FR", I'm trying to replace the simple link by a
selection list that triggers a locale change everytime the selection
value changes. I managed to make that work with the following template
:
<xsl:template match="/locales">
<div>
<xsl:value-of select="$current_locale"/>
<form action="" method="POST" name="locale_chooser_form">
<select size="1" name="locale" id="locale_chooser"
onchange="location.href='?locale='+document.getElementById('locale_chooser').options[document.getElementById('locale_chooser').options.selectedIndex].value">
<xsl:apply-templates/>
</select>
</form>
</div>
</xsl:template>
<xsl:template match="locale">
<option>
<xsl:if test="$current_locale = @code">
<xsl:attribute name="selected">
<xsl:value-of select="'selected'"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
<xsl:value-of select="@code"/>
</xsl:attribute>
<xsl:value-of select="@label"/>
</option>
</xsl:template>
It works great for the functionality but there is a bug : I don't
manage to set the current_locale parameter for the transformation to
the locale currently selected. Here is the corresponding sitemap
snippet :
<map:match pattern="region/locales">
<map:generate src="locales.xml" type="jx">
<map:parameter name="lenient-xpath" value="true"/>
</map:generate>
<map:transform src="themes/default/locales.xsl">
<map:parameter name="current_locale" value="{../locale}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
But it doesn't set the selected attribute correctly. Any idea ?
--
Sebastien ARBOGAST
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]