Warning: file_put_contents() [function.file-put-contents]: Only 0 of 196 bytes written, possibly out of free disk space in /disk2/home/symphonyweb/public_html/extensions/xmlfield/fields/field.xml.php on line 63
“Language Switch” – XSLT Utilities – Download – Symphony.
Release Date:
6 Dec 2016


This utility adds a language switch for all languages of the site (when using multilanguage the right way).

It takes its information from the navigation and fl-languages datasources.

Parameters are the most difficult part to implement as they come in one language only. It is therefore necessary to look up a parameter's translation in a datasource. For example: If your page is products and the parameter is $prodctgroup, you will need a datasource that lists all product groups in all languages. The xml shows an example. For sites with many parameters on different pages it might be useful to apply a template, placed on each page, from within the utility.


View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="fl-languages">
    <ul class="nav__language">
        <xsl:apply-templates select="supported-languages/item" />

<xsl:template match="supported-languages/item">
    <li class="nav__language__item">
        <xsl:if test="/data/fl-languages/current-language/@handle = current()/@handle">
            <xsl:attribute name="class">nav__language__item  nav__language__item--active</xsl:attribute>
        <a class="nav__language__item__link">
            <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@handle)" />
                <xsl:apply-templates select="/data/navigation" mode="language">
                    <xsl:with-param name="lang" select="@handle" />
                <!-- PARAMETERS START -->
                <xsl:value-of select="concat('/', /data/DATASOURCENAME/entry/FIELD/item[@lang = current()/@handle]/@handle)" />
                <!-- PARAMETERS END -->
            <xsl:value-of select="@handle" />

<xsl:template match="navigation" mode="language">
    <xsl:param name="lang" select="''" />
	<xsl:apply-templates select="page" mode="language">
		<xsl:with-param name="lang" select="$lang" />

<xsl:template match="page" mode="language">
	<xsl:param name="lang" select="''" />
	<xsl:if test="descendant-or-self::node()[@id = $current-page-id]">
		/<xsl:value-of select="item[@lang = $lang]/@handle" />
	<xsl:if test="descendant-or-self::node()[@id = $current-page-id]">
		<xsl:apply-templates select="page" mode="language">
			<xsl:with-param name="lang" select="$lang" />


Discuss this XSLT Utility

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