To facilitate the integration of a graphic charter, a number of XSLT variables are available from XSLT files.

These variables are defined in the variables file.xsl of the "web" workspace:

List of variables and their descriptions

VariableDescription
$uri-prefixApplication context according to rendering context.
Ex: '/cms', '/cms/preview'.
See AmetysXSLTHelper.uriPrefix()
$site-uri-prefix

Context of current site according to rendering context/
Ex: '/cms/www', '/cms/preview/www'.
See AmetysXSLTHelper.siteUriPrefix()

$absolute-uri-prefixSame as $uriPrefix but with absoluteurl .
Ex:'http://www.ametys.org/cms/' or'http://www.ametys.org/cms/preview/
See AmetysXSLTHelper.absoluteUriPrefix()
$absolute-site-uri-prefixSame as $siteUriPrefix but with the absoluteurl .
Ex:'http://www.ametys.org' or'http://www.ametys.org/cms/www' or'http://www.ametys.org/cms/preview/www'
See AmetysXSLTHelper.absoluteSiteUriPrefix())
$page-pathPath of the current page. The path is relative to the sitemap.
Ex: "rubrique/sous-rubrique/page"
See AmetysXSLTHelper.pagePath()
$page-idUnique identifier of the current page (in the form page://...)
See AmetysXSLTHelper.pageId()
$langLanguage code of the current page
Ex: fr, en, es, ...
See AmetysXSLTHelper.lang()
$siteCurrent site name.
Ex: "www", "default", "medecine", ...
See AmetysXSLTHelper.site()
$skin

Name of the skin used by the current site
Ex: "demo"
See AmetysXSLTHelper.skin ( )

$templateName of the template currently in use, i.e. the current page
Ex: "page", "index", ...
See AmetysXSLTHelper.template()
$zone

Name of zone being rendered (content or service) with 'default' as default value if rendering is not in a zone

From Ametys 4.2

See AmetysXSLTHelper.zone('default')

$rendering-contextCurrent rendering context :
  • "back" - if rendering is done in the backoffice
  • "preview" - whether rendering is done in preview or live mode
  • "front" - if rendered from the site
 See AmetysXSLTHelper.renderingContext()


Examples of use:

 

Link to home page (index page)

<a href="{$site-uri-prefix}/{$lang}/index.html">Accueil</a>  

Disabling a feature in the back office

<xsl:choose>         
 <xsl:when test="$rendering-context = 'back'">  
     <xsl:text>javascript:alert("Cette fonctionnalité ne peut pas être utilisée dans le back-office. Ouvrez la prévisualisation pour l'utiliser.");</xsl:text>  
    </xsl:when test>  
    <xsl:otherwise>  
     ...  
    </xsl:otherwise>  
</xsl:choose>  

Translation of a i18n key from the skin

<head>  
 <title><i18n:text i18n:key="SKIN_TITLE" i18n:catalogue="skin.{$skin}"/></title>  
 ...  
</head>  
Back to top