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
hi every one.
i need to preserve the state of my navigation tree, when the node clicked donĀ“t hava a child node.
this is my code:
<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" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml "><xsl:output method="xml" omit-xml-declaration="yes" /><xsl:param name="currentPage"/><xsl:variable name="currentPageTemp"/><xsl:variable name="level" select="2"/><xsl:variable name="maxLevelForSitemap" select="5"/> <xsl:variable name="hdiContent" select="umbraco.library:GetXmlNodeById('2289')/hdiContent"/><xsl:variable name="pdfFiles" select="umbraco.library:GetXmlNodeById('2289')/hdiPdfFileElement"/><xsl:variable name="terminosCondiciones" select="umbraco.library:GetXmlNodeById('2289')/hdiTermsCondContent"/> <xsl:template match="/"> <ul class="secNav"> <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level=$level]/*[@isDoc and name() != $hdiContent and name() != $pdfFiles and name() != $terminosCondiciones and string(umbracoNaviHide) != '1']"> <xsl:if test="count(./*) > 0"> <li class="secNavItem"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="$currentPage/@id = current()/@id"> <xsl:call-template name="drawChildNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </li> </xsl:if> </xsl:for-each> </ul> </xsl:template> <xsl:template name="drawChildNodes"><xsl:param name="parent"/> <ul class='secNav'> <!--<xsl:for-each select="$currentPage/child::* [name() != $documentTypeAlias and string(umbracoNaviHide) != '1']">--> <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and name() != $hdiContent and @level <= $maxLevelForSitemap]"> <li class="thirdNavItem hasChild"> <a style="margin-left:3px;" href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul></xsl:template></xsl:stylesheet>
regards.
Well i find a solution. a little diferent that my question, but relsolve the problem.
<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" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml "> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:param name="currentPage"/> <xsl:variable name="level" select="2"/> <xsl:variable name="maxLevelForSitemap" select="5"/> <xsl:template match="/">
<ul class="secNav"> <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level=$level]/*[@isDoc and string(umbracoNaviHide) != '1']"> <xsl:element name="li"> <xsl:choose> <xsl:when test="$currentPage/@id = current()/@id"> <xsl:attribute name="class">secNavItemActivexsl:attribute> xsl:when> <xsl:otherwise> <xsl:attribute name="class">secNavItemxsl:attribute> xsl:otherwise> xsl:choose> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> a> xsl:element> <xsl:if test="$currentPage/@id = current()/@id"> <xsl:call-template name="drawChildNodes"> <xsl:with-param name="parent" select="."/> xsl:call-template> xsl:if> <xsl:if test="current()/@id = $currentPage/parent::*/@id"> <xsl:call-template name="drawChildNodes"> <xsl:with-param name="parent" select="$currentPage/parent::*"/> xsl:call-template> xsl:if> xsl:for-each> ul> xsl:template> <xsl:template name="drawChildNodes"> <xsl:param name="parent"/> <xsl:if test="count(* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]) > '0'"> <ul class='secNav'> <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]"> <xsl:element name="li"> <xsl:choose> <xsl:when test="$currentPage/@id = current()/@id"> <xsl:attribute name="class">thirdNavItemActive hasChildxsl:attribute> xsl:when> <xsl:otherwise> <xsl:attribute name="class">thirdNavItem hasChildxsl:attribute> xsl:otherwise> xsl:choose> <a style="margin-left:3px;" href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> a> xsl:element> xsl:for-each> ul> xsl:if> xsl:template>xsl:stylesheet>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Preserve a navigation tree state when node clicked don´t have child
hi every one.
i need to preserve the state of my navigation tree, when the node clicked donĀ“t hava a child node.
this is my code:
<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" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<xsl:variable name="currentPageTemp"/>
<xsl:variable name="level" select="2"/>
<xsl:variable name="maxLevelForSitemap" select="5"/>
<xsl:variable name="hdiContent" select="umbraco.library:GetXmlNodeById('2289')/hdiContent"/>
<xsl:variable name="pdfFiles" select="umbraco.library:GetXmlNodeById('2289')/hdiPdfFileElement"/>
<xsl:variable name="terminosCondiciones" select="umbraco.library:GetXmlNodeById('2289')/hdiTermsCondContent"/>
<xsl:template match="/">
<ul class="secNav">
<xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level=$level]/*[@isDoc
and name() != $hdiContent
and name() != $pdfFiles
and name() != $terminosCondiciones
and string(umbracoNaviHide) != '1']">
<xsl:if test="count(./*) > 0">
<li class="secNavItem">
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="$currentPage/@id = current()/@id">
<xsl:call-template name="drawChildNodes">
<xsl:with-param name="parent" select="."/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="drawChildNodes">
<xsl:param name="parent"/>
<ul class='secNav'>
<!--<xsl:for-each select="$currentPage/child::* [name() != $documentTypeAlias and string(umbracoNaviHide) != '1']">-->
<xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and name() != $hdiContent and @level <= $maxLevelForSitemap]">
<li class="thirdNavItem hasChild">
<a style="margin-left:3px;" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
regards.
Well i find a solution. a little diferent that my question, but relsolve the problem.
<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" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<xsl:variable name="level" select="2"/>
<xsl:variable name="maxLevelForSitemap" select="5"/>
<xsl:template match="/">
<ul class="secNav">
<xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level=$level]/*[@isDoc
and string(umbracoNaviHide) != '1']">
<xsl:element name="li">
<xsl:choose>
<xsl:when test="$currentPage/@id = current()/@id">
<xsl:attribute name="class">secNavItemActivexsl:attribute>
xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">secNavItemxsl:attribute>
xsl:otherwise>
xsl:choose>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
a>
xsl:element>
<xsl:if test="$currentPage/@id = current()/@id">
<xsl:call-template name="drawChildNodes">
<xsl:with-param name="parent" select="."/>
xsl:call-template>
xsl:if>
<xsl:if test="current()/@id = $currentPage/parent::*/@id">
<xsl:call-template name="drawChildNodes">
<xsl:with-param name="parent" select="$currentPage/parent::*"/>
xsl:call-template>
xsl:if>
xsl:for-each>
ul>
xsl:template>
<xsl:template name="drawChildNodes">
<xsl:param name="parent"/>
<xsl:if test="count(* [@isDoc and string(umbracoNaviHide) != '1'
and @level <= $maxLevelForSitemap]) > '0'">
<ul class='secNav'>
<xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]">
<xsl:element name="li">
<xsl:choose>
<xsl:when test="$currentPage/@id = current()/@id">
<xsl:attribute name="class">thirdNavItemActive hasChildxsl:attribute>
xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">thirdNavItem hasChildxsl:attribute>
xsl:otherwise>
xsl:choose>
<a style="margin-left:3px;" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
a>
xsl:element>
xsl:for-each>
ul>
xsl:if>
xsl:template>
xsl:stylesheet>
is working on a reply...