cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Arbogast <>
Subject Re: [I18N] [Samples] [XSLT] Something I don't understand in I18N samples
Date Tue, 17 May 2005 22:56:05 GMT
> <a href="{@href}" 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">
            <xsl:value-of select="$current_locale"/>
        <form action="" method="POST" name="locale_chooser_form">
            <select size="1" name="locale" id="locale_chooser"

<xsl:template match="locale">
            <xsl:if test="$current_locale = @code">
                <xsl:attribute name="selected">
                    <xsl:value-of select="'selected'"/>
            <xsl:attribute name="value">
                <xsl:value-of select="@code"/>
            <xsl:value-of select="@label"/>

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:transform src="themes/default/locales.xsl">
                    <map:parameter name="current_locale" value="{../locale}"/>
                <map:serialize type="xml"/>

But it doesn't set the selected attribute correctly. Any idea ?

Sebastien ARBOGAST

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message