<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/> <!-- The fun starts here --> <xsl:if test="count($items) > 0"> <ul> <xsl:for-each select="$items"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:if>
</xsl:template>
</xsl:stylesheet>
But only generates the child objects for the given parent node while on the parent node (page). I want to generate all sub menus for all parent nodes (sections) to build a hover menu. If this doesn't make sense, I will try to elaborate further.
Have you had a peek at the Cogworks Flexible Navigation package? I just made a dropdown menu with that and some CSS - didn't take longer than about 15 mins to do :-)
What I did was:
Install Cogworks Flexible Navigation
Go to line 146 in the XSLT file and replace thestatement with this:
Thanks, this installs fine, but still only renders one menu tab's sub items. What I would like to do, is render all sub menus (at the same time) for all parent categories.
So, when hovering over a given tab, menu items will drop down. I'm fine with the CSS/JS, it's getting the entire menu to generate that I'm having trouble with. Once I can get it onto the document, the rest I can take care of. Is there documentation around this?
<xsl:variablename="items"select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/> <!-- The fun starts here --> <xsl:iftest="count($items) > 0"> <ul> <xsl:for-eachselect="$items"> <li> <ahref="{umbraco.library:NiceUrl(@id)}"> <xsl:value-ofselect="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:if>
</xsl:template> </xsl:stylesheet>
to
<xsl:variable name="level" select="1"/> <!-- Depending on how you have your website Content Section Structured Generally your default is on Level 1 -->
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <ahref="{umbraco.library:NiceUrl(@id)}"> <xsl:value-ofselect="@nodeName"/> </a> <!-- Drop Down Menu --> <xsl:if test="count(./*[@isDoc and string(umbracoNaviHide) !='1'])>0"> <ul> <xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) !='1']"> <li> <ahref="{umbraco.library:NiceUrl(@id)}"> <xsl:value-ofselect="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:if> <!-- End Of Drop Down Menu --> </li> </xsl:for-each> </ul>
</xsl:template>
If you are ok with CSS just used yours to get it to display on hover
Thanks, this worked great. There was a little issue with the formatted text, no space between "value-ofselect" should be "value-of select". Thanks a bunch.
<xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:variable name="level" select="1"/> <!-- Depending on how you have your website Content Section Structured Generally your default is on Level 1 --> <xsl:param name="currentPage"/> <xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <!-- Drop Down Menu --> <xsl:if test="count(./*[@isDoc and string(umbracoNaviHide) !='1'])>0"> <ul> <xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) !='1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:if> <!-- End Of Drop Down Menu --> </li> </xsl:for-each> </ul>
I just noticed the formatting i dont know why the spaces were removed but great if you got it working. Remember to mark this thread as solved for others.
Menu Navigation (drop down menus)
i
I applogize in advance if this has been covered, but am looking for a little help getting sub navigation work outside of the current page.
Basically, I want to generate a menu for category with only next level children (no recursion).
I'm using this macro/xslt:
But only generates the child objects for the given parent node while on the parent node (page). I want to generate all sub menus for all parent nodes (sections) to build a hover menu. If this doesn't make sense, I will try to elaborate further.
I'm using the 4.7 build
Thanks in advance.
Have you taken a look at the sitemap XSLT Template? Unless I'm misunderstanding, it'll probably do what you need.
Hi,
Have you had a peek at the Cogworks Flexible Navigation package? I just made a dropdown menu with that and some CSS - didn't take longer than about 15 mins to do :-)
What I did was:
Thanks, this installs fine, but still only renders one menu tab's sub items. What I would like to do, is render all sub menus (at the same time) for all parent categories.
So, when hovering over a given tab, menu items will drop down. I'm fine with the CSS/JS, it's getting the entire menu to generate that I'm having trouble with. Once I can get it onto the document, the rest I can take care of. Is there documentation around this?
Amir, I don't see the xslt sitemap file; is this something I need to install separately?
I realy appreciate the help, thanks everyone.
Hi,
Here is something you can try in your XSLT. Try changing this
to
If you are ok with CSS just used yours to get it to display on hover
//fuji
Weird, my post was duplicated on Submit!!! Sorry for that
Thanks, this worked great. There was a little issue with the formatted text, no space between "value-ofselect" should be "value-of select". Thanks a bunch.
For anyone else, here is the entire xslt file:
Hi
I just noticed the formatting i dont know why the spaces were removed but great if you got it working. Remember to mark this thread as solved for others.
//fuji
I don't see an option do mark the thread as solved? I'll try adding it to the description if that is still possible.
is working on a reply...