Search

Hi @all

My language selector does work more or less but i won't do give out some other link names but i can't access them. i think its a small thing but i didn't find out...

my template look like this:

<xsl:template name="sprachwahl">
    <xsl:param name="supported-language-codes" select="/data/events/language-redirect/supported-languages/item/@handle"/>
    <xsl:param name="current-language-code" select="/data/events/language-redirect/current-language/@handle"/>
        <xsl:for-each select="$supported-language-codes">
                <xsl:choose>
                    <xsl:when test=". = $current-language-code">
                        <span><xsl:value-of select="."/></span>
                    </xsl:when>
                    <xsl:otherwise>
                   <a href="{$root}/{.}{$parent-path}/{$current-page}"><xsl:value-of select="."/></a>
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:for-each>
</xsl:template>

the output in debug mode look like this:

<events>
        <language-redirect>
            <current-language handle="en">EN</current-language>
            <supported-languages>
                <item handle="de">DE</item>
                <item handle="fr">FR</item>
                <item handle="en">EN</item>
            </supported-languages>
        </language-redirect>
    </events>

and the html looks like this:

<div class="grid-2 box1"> 
          <a href="http://muster.ch/de//startseite">de</a> 
          <a href="http://muster.ch/fr//startseite">fr</a> 
          <span>en</span> 
        </div> 

but id should look like this:

<div class="grid-2 box1"> 
          <a href="http://muster.ch/de/startseite">DE</a> 
          <a href="http://muster.ch/fr/startseite">FR</a> 
          <span>EN</span> 
        </div>

so i want to give out the language names in capital letters

any idea?

thanks for advice

greez...

Use css to change the markup for the a href to capitols.. .box1 a, .box1 span{text-transform:uppercase;} It's better to alter presentation in CSS rather than the code.

Your code works as expected

<a href="{$root}/{.}{$parent-path}/{$current-page}"><xsl:value-of select="."/></a>

outputs $root + / + current language code + $parent-path (in your case /) + / + $current-page

http://positiv.positivrat.ch + / + de + / + / + startseite

Thanks to moonoo2 that was the right tipp! Sometimes its too easy to see!

greez

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details