Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

language toggle

Status
Not open for further replies.

lwoody123

Programmer
Jun 6, 2007
4
GB
Hi all,

the following piece of code generates a langauge toggle. Could anyone give me some ideas on how i would add a condition that adds a <strong> tag around the selected langauge (locale) and have it as text rather than a link?

<xsl:template name="rk_top_lang_nav">
<xsl:choose>
<xsl:when test="count(/*/locales/locale) > 1">
<ul id="navlang">
<xsl:for-each select="/*/locales/locale">
<li>
<xsl:if test="position() = 1 ">
<xsl:attribute name="class">first</xsl:attribute>
</xsl:if>
<a href="{locale_link}"><xsl:value-of select="locale_name"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:eek:therwise/>
</xsl:choose>
</xsl:template>


thanx in advance
 
>... how i would add a condition that adds a <strong> tag around the selected langauge (locale) and have it as text rather than a link?
What condition would it be? For instance this.
[tt]
<xsl:template name="rk_top_lang_nav">
<xsl:choose>
<xsl:when test="count(/*/locales/locale) > 1">
<ul id="navlang">
<xsl:for-each select="/*/locales/locale">
<li>
<xsl:if test="position() = 1 ">
<xsl:attribute name="class">first</xsl:attribute>
</xsl:if>
[blue]<xsl:choose>
<xsl:when test="[/blue][green]position() mod 2 = 0[/green][blue]">
<a href="{locale_link}"><xsl:value-of select="locale_name"/></a>
</xsl:when>
<xsl:eek:therwise>
<strong><xsl:value-of select="locale_name"/></strong>
</xsl:eek:therwise>
</xsl:choose>[/blue]
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:eek:therwise/>
</xsl:choose>
</xsl:template>
[/tt]
 
Thanks for the reply but the first test is just there to put a line in between each language except for the first one (ie if position =1) Therefore it doesnt matter what position the langauge is , if it is the current langauge it should still be bold and not a link. In need to say something like 'if the link is selected' or if the locale name is equal to...

 
I wish it was but sadly not. The problem is i'm working with a CMS that was brought by the company i work for. However, there are a few tweaks that need adding. Like this style to the language toggle. I cant seem to find how the CMS knows which language i am in so im looking for an alternative solution. Hope that makes sense!
 
You seem not able to enounciate the problem with clarity. You should better seek help from the tool supplier.
 
It's very hard to explain. All i'm after is an xsl statement that can test if a link has been selected or not. But thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top