<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" > <xsl:template name="navigation.row"> <xsl:param name="rootNode"/> <xsl:param name="CSSLayoutClass"/> <!-- read xml item entries and create the link bar --> <xsl:for-each select="$rootNode/item"> <xsl:call-template name="addLink"> <xsl:with-param name="CSSLayoutClass" select="$CSSLayoutClass"/> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template name="addLink"> <xsl:param name="createSiteMap"/> <xsl:param name="CSSLayoutClass"/> <xsl:choose> <!-- item @type is "intern" -> add the web application path before the link --> <xsl:when test="@type = 'intern'"> <a class="{$CSSLayoutClass}"> <!--target --> <xsl:attribute name="target"> <xsl:value-of select="@target"/> </xsl:attribute> <!--add lastPage=@href to URL --> <xsl:variable name="href_intern_tmp"> <xsl:call-template name="UrlSetParam"> <xsl:with-param name="url" select="concat($WebApplicationBaseURL,substring-after(@href,'/'))"/> <xsl:with-param name="par" select="'XSL.lastPage.SESSION'"/> <xsl:with-param name="value" select="@href"/> </xsl:call-template> </xsl:variable> <xsl:attribute name="href"> <xsl:call-template name="UrlAddSession"> <xsl:with-param name="url" select="$href_intern_tmp"/> </xsl:call-template> </xsl:attribute> <xsl:choose> <xsl:when test="@style = 'bold'"> <span style="font-weight:bold;"> <xsl:choose> <xsl:when test="./label[lang($CurrentLang)] != ''"> <xsl:value-of select="./label[lang($CurrentLang)]"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="./label[lang($DefaultLang)]"/> </xsl:otherwise> </xsl:choose> </span> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="./label[lang($CurrentLang)] != ''"> <xsl:value-of select="./label[lang($CurrentLang)]"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="./label[lang($DefaultLang)]"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </a> </xsl:when> <!-- item @type is extern --> <xsl:otherwise> <a class="{$CSSLayoutClass}"> <xsl:attribute name="target"> <xsl:value-of select="@target"/> </xsl:attribute> <!-- set attribute @href --> <xsl:variable name="href_temp"> <xsl:choose> <!-- build $webapplicationbaseurl before link in case @href doesn't start with 'http' & co. --> <xsl:when test=" starts-with(@href,'http:') or starts-with(@href,'https:') or starts-with(@href,'mailto:') or starts-with(@href,'ftp:')"> <xsl:value-of select="@href"/> </xsl:when> <!-- link is relative and not starting with http ... --> <xsl:otherwise> <xsl:call-template name="UrlSetParam"> <xsl:with-param name="url" select="concat($WebApplicationBaseURL,substring-after(@href,'/'))"/> <xsl:with-param name="par" select="'XSL.lastPage.SESSION'"/> <xsl:with-param name="value" select="fn:encode-for-uri(@href)"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:variable> <!--add session --> <xsl:variable name="href_temp2"> <xsl:call-template name="UrlAddSession"> <xsl:with-param name="url" select="$href_temp"/> </xsl:call-template> </xsl:variable> <xsl:attribute name="href"> <xsl:choose> <!-- in case of $href_temp contains 'servlet' append 'lang=$currentlang' --> <xsl:when test=" contains($href_temp,'/servlets/') "> <xsl:call-template name="UrlSetParam"> <xsl:with-param name="url" select="$href_temp2"/> <xsl:with-param name="par" select="'lang'"/> <xsl:with-param name="value" select="$CurrentLang"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$href_temp2"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <!-- end: set attribute @href --> <xsl:choose> <xsl:when test="@style = 'bold'"> <span style="font-weight:bold;"> <xsl:choose> <xsl:when test="./label[lang($CurrentLang)] != ''"> <xsl:value-of select="./label[lang($CurrentLang)]"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="./label[lang($DefaultLang)]"/> </xsl:otherwise> </xsl:choose> </span> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="./label[lang($CurrentLang)] != ''"> <xsl:value-of select="./label[lang($CurrentLang)]"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="./label[lang($DefaultLang)]"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </a> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="navbar"> <xsl:param name="rootNode"/> <ul class="navbar-nav"> <xsl:for-each select="$rootNode/item"> <li class="nav-item"> <xsl:if test="@userNot = $CurrentUser"> <xsl:attribute name="hidden"/> <xsl:attribute name="class">hidden</xsl:attribute> </xsl:if> <xsl:variable name="top_link"> <xsl:value-of select="@href"/> </xsl:variable> <a class="nav-link" href="{$top_link}"> <xsl:if test="./label[lang($CurrentLang)] != ''"> <xsl:value-of select="./label[lang($CurrentLang)]"/> </xsl:if> </a> </li> </xsl:for-each> </ul> </xsl:template> <!-- <xsl:template name="langalt"> <xsl:if test="$CurrentLang != 'de'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'de'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/> </xsl:call-template> </link> </xsl:if> <xsl:if test="$CurrentLang != 'en'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'en'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=en')"/> </xsl:call-template> </link> </xsl:if> <xsl:if test="$CurrentLang != 'es'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'es'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=es')"/> </xsl:call-template> </link> </xsl:if> <xsl:if test="$CurrentLang != 'fr'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'fr'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=fr')"/> </xsl:call-template> </link> </xsl:if> <xsl:if test="$CurrentLang != 'it'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'it'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=it')"/> </xsl:call-template> </link> </xsl:if> <xsl:if test="$CurrentLang != 'ja'"> <link> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="'ja'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=ja')"/> </xsl:call-template> </link> </xsl:if> </xsl:template> --> <xsl:template name="langchooser"> <xsl:param name="lang"/> <xsl:param name="url"/> <xsl:param name="alternative"/> <xsl:call-template name="langref"> <xsl:with-param name="lang" select="$lang"/> <xsl:with-param name="url" select="$url"/> <xsl:with-param name="alternative" select="concat($url, '?lang=', $lang)"/> </xsl:call-template> <xsl:attribute name="title"> <xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$lang))/i18n/text()"/> </xsl:attribute> <xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$lang))/i18n/text()"/> </xsl:template> <xsl:template name="langref"> <xsl:param name="lang"/> <xsl:param name="url"/> <xsl:param name="alternative"/> <xsl:variable name="newurl"> <xsl:call-template name="UrlSetParam"> <xsl:with-param name="url" select="$url"/> <xsl:with-param name="par" select="'lang'"/> <xsl:with-param name="value" select="$lang"/> </xsl:call-template> </xsl:variable> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="contains($newurl,'MCR:ERROR')"> <xsl:call-template name="UrlAddSession"> <xsl:with-param name="url" select="$alternative"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="UrlAddSession"> <xsl:with-param name="url" select="$newurl"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="hreflang"> <xsl:value-of select="$lang"/> </xsl:attribute> <xsl:attribute name="rel"> <xsl:value-of select="'alternate'"/> </xsl:attribute> </xsl:template> <xsl:template name="langmenu"> <xsl:param name="rootNode"/> <ul class="navbar-nav"> <li class="nav-item dropdown languages"> <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown"> <span class="fas fa-globe" aria-hidden="true"/> <span> <xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$CurrentLang))/i18n/text()"/> </span> <b class="caret"/> </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item"> <xsl:call-template name="langchooser"> <xsl:with-param name="lang" select="'de'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/> </xsl:call-template> </a> <a class="dropdown-item"> <xsl:call-template name="langchooser"> <xsl:with-param name="lang" select="'en'"/> <xsl:with-param name="url" select="$RequestURL"/> <xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/> </xsl:call-template> </a> </div> </li> </ul> </xsl:template> <xsl:template match="TOC | toc"> <xsl:for-each select="$loaded_navigation_xml//item[@href=$browserAddress]"> <ul> <xsl:for-each select="child::item"> <li> <xsl:call-template name="addLink"/> </li> </xsl:for-each> </ul> </xsl:for-each> </xsl:template> </xsl:stylesheet>