Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hey.
I have created a xslt navigation template...
But when the paged is opened in a childnode the menu collaps again.
How can I let it be open.
http://v2.christiankragh.dk
My xslt:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:param name="level" select="1"/> <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root" /> <xsl:variable name="homeNode" select="$rootNode/Home [@isDoc]" /> <xsl:template match="/"> <ul class="level_0"> <li> <xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia($homeNode/sideikon, 0)/umbracoFile"/>')</xsl:attribute> <a href="{umbraco.library:NiceUrl($homeNode/@id)}" title='{$homeNode/@nodeName}'> <xsl:if test="$currentPage/@id = $homeNode/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <xsl:value-of select="$homeNode/@nodeName"/> </a> <xsl:call-template name="menu"> <xsl:with-param name="level" select="$level"/> </xsl:call-template> </li> </ul> </xsl:template> <xsl:template name="menu"> <xsl:param name="level"/> <ul class="level_{$level}"> <xsl:if test="count($currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path)]) > '0'"> <xsl:for-each select="$currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path) and name(.) != 'persontaender' and name(.) != 'stoerrelse' and name(.) != 'Logind']"> <li> <xsl:if test="sideikon != ''"> <xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia(sideikon, 0)/umbracoFile"/>')</xsl:attribute> </xsl:if> <a href='javascript:void(0);' onclick="$('#menu{@id}').toggleClass('hidecontent');" title='ExpandMenu' class='menuexpand'> <img src='/media/1701/plus.png' /> </a> <a href='{umbraco.library:NiceUrl(@id)}' title='{@nodeName}'> <xsl:if test="$currentPage/@id = current()/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0' and name(.) != 'PersonSide'"> <xsl:call-template name="submenu"> <xsl:with-param name="level" select="$level+1"/> <xsl:with-param name="reffs" select="@id"/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </xsl:if> </ul> </xsl:template> <xsl:template name="submenu"> <xsl:param name="level"/> <xsl:param name="reffs" select="'Not Available'"/> <ul class="level_{$level}" id='menu{$reffs}'> <xsl:if test="$level = 2"> <xsl:attribute name="class">hidecontent</xsl:attribute> </xsl:if> <xsl:for-each select="current()/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path) and name(.) != 'persontaender' and name(.) != 'stoerrelse' and name(.) != 'Logind']"> <li> <xsl:if test="sideikon != ''"> <xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia(sideikon, 0)/umbracoFile"/>')</xsl:attribute> </xsl:if> <a href='{umbraco.library:NiceUrl(@id)}' title='{@nodeName}'> <xsl:if test="$currentPage/@id = current()/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0' and umbraco.library:HasAccess(@id,@path) and name(.) != 'PersonSide'"> <xsl:call-template name="submenu"> <xsl:with-param name="level" select="$level+1"/> <xsl:with-param name="reffs" select="@id"/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </ul> </xsl:template></xsl:stylesheet>
Hi Christian,
So basically you want the menu to remember the parent of the child when you open the related note? You should be able to achive this with ajax so that it remembers the session.
fuji
More like this:
<xsl:if test="$currentPage/@id = current()/@id">
Hey again...
The text in bold is the anser...
Best regardsChristian
<xsl:template match="/"> <ul class="level_0"> <li> <xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia($homeNode/sideikon, 0)/umbracoFile"/>')</xsl:attribute> <a href="{umbraco.library:NiceUrl($homeNode/@id)}" title='{$homeNode/@nodeName}'> <xsl:if test="$currentPage/@id = $homeNode/@id"> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <xsl:value-of select="$homeNode/@nodeName"/> </a> <xsl:call-template name="menu"> <xsl:with-param name="level" select="$level"/> </xsl:call-template> </li> </ul> <script type="text/javascript"> <xsl:for-each select="$currentPage/ancestor-or-self::*"> <xsl:if test="@id != -1"> $('#menu<xsl:value-of select="@id"/>').toggleClass('hidecontent'); var srcs=($('#menu<xsl:value-of select="@id"/>img').attr('src') === '/media/7618/minus2.png') ? '/media/7612/plus2.png' : '/media/7618/minus2.png'; $('#menu<xsl:value-of select="@id"/>img').attr('src',srcs); </xsl:if> </xsl:for-each> </script></xsl:template>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Menu
Hey.
I have created a xslt navigation template...
But when the paged is opened in a childnode the menu collaps again.
How can I let it be open.
http://v2.christiankragh.dk
My xslt:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:param name="level" select="1"/>
<xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root" />
<xsl:variable name="homeNode" select="$rootNode/Home [@isDoc]" />
<xsl:template match="/">
<ul class="level_0">
<li>
<xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia($homeNode/sideikon, 0)/umbracoFile"/>')</xsl:attribute>
<a href="{umbraco.library:NiceUrl($homeNode/@id)}" title='{$homeNode/@nodeName}'>
<xsl:if test="$currentPage/@id = $homeNode/@id">
<xsl:attribute name="class">Selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$homeNode/@nodeName"/>
</a>
<xsl:call-template name="menu">
<xsl:with-param name="level" select="$level"/>
</xsl:call-template>
</li>
</ul>
</xsl:template>
<xsl:template name="menu">
<xsl:param name="level"/>
<ul class="level_{$level}">
<xsl:if test="count($currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path)]) > '0'">
<xsl:for-each select="$currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path) and name(.) != 'persontaender' and name(.) != 'stoerrelse' and name(.) != 'Logind']">
<li>
<xsl:if test="sideikon != ''">
<xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia(sideikon, 0)/umbracoFile"/>')</xsl:attribute>
</xsl:if>
<a href='javascript:void(0);' onclick="$('#menu{@id}').toggleClass('hidecontent');" title='ExpandMenu' class='menuexpand'>
<img src='/media/1701/plus.png' />
</a>
<a href='{umbraco.library:NiceUrl(@id)}' title='{@nodeName}'>
<xsl:if test="$currentPage/@id = current()/@id">
<xsl:attribute name="class">Selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0' and name(.) != 'PersonSide'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
<xsl:with-param name="reffs" select="@id"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</xsl:if>
</ul>
</xsl:template>
<xsl:template name="submenu">
<xsl:param name="level"/>
<xsl:param name="reffs" select="'Not Available'"/>
<ul class="level_{$level}" id='menu{$reffs}'>
<xsl:if test="$level = 2">
<xsl:attribute name="class">hidecontent</xsl:attribute>
</xsl:if>
<xsl:for-each select="current()/* [@isDoc and string(umbracoNaviHide) != '1' and umbraco.library:HasAccess(@id,@path) and name(.) != 'persontaender' and name(.) != 'stoerrelse' and name(.) != 'Logind']">
<li>
<xsl:if test="sideikon != ''">
<xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia(sideikon, 0)/umbracoFile"/>')</xsl:attribute>
</xsl:if>
<a href='{umbraco.library:NiceUrl(@id)}' title='{@nodeName}'>
<xsl:if test="$currentPage/@id = current()/@id">
<xsl:attribute name="class">Selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="count(current()/* [@isDoc and string(umbracoNaviHide) != '1']) > '0' and umbraco.library:HasAccess(@id,@path) and name(.) != 'PersonSide'">
<xsl:call-template name="submenu">
<xsl:with-param name="level" select="$level+1"/>
<xsl:with-param name="reffs" select="@id"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi Christian,
So basically you want the menu to remember the parent of the child when you open the related note? You should be able to achive this with ajax so that it remembers the session.
fuji
More like this:
<xsl:if test="$currentPage/@id = current()/@id">
Hey again...
The text in bold is the anser...
Best regards
Christian
<xsl:template match="/">
<ul class="level_0">
<li>
<xsl:attribute name="style">background-image:url('<xsl:value-of select="umbraco.library:GetMedia($homeNode/sideikon, 0)/umbracoFile"/>')</xsl:attribute>
<a href="{umbraco.library:NiceUrl($homeNode/@id)}" title='{$homeNode/@nodeName}'>
<xsl:if test="$currentPage/@id = $homeNode/@id">
<xsl:attribute name="class">Selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$homeNode/@nodeName"/>
</a>
<xsl:call-template name="menu">
<xsl:with-param name="level" select="$level"/>
</xsl:call-template>
</li>
</ul>
<script type="text/javascript">
<xsl:for-each select="$currentPage/ancestor-or-self::*">
<xsl:if test="@id != -1">
$('#menu<xsl:value-of select="@id"/>').toggleClass('hidecontent');
var srcs=($('#menu<xsl:value-of select="@id"/>img').attr('src') === '/media/7618/minus2.png') ? '/media/7612/plus2.png' : '/media/7618/minus2.png';
$('#menu<xsl:value-of select="@id"/>img').attr('src',srcs);
</xsl:if>
</xsl:for-each>
</script>
</xsl:template>
is working on a reply...