I have sub navigation within my site that displays all nav from levels 2 / 3 / 4 however the current XSLT I am using, which has been applied from another post on this forum, displays all nodes open. I need this to only show the descendants of the current node we are on. Here is my XSLT:
This displays as follows (apologies for the black lines - confidentiality and all that) but it gives an idea. I iodally just need to show one of these sections at a time. i.e When you click the node named 'Testing' then the other two nodes with arrows on them would not be expanded but the 'Testing' node and all of its children would be expanded. Any help greatly appreciated.
If the problem is only of expanding the menu then I personally recommend you jquery. Jquery provide such a functionality of toggling the menus. Here is one example http://www.sohtanaka.com/web-design/examples/toggle/
jQuery is great to dynamically do this, but it means the markup is still on the page, just hidden from the user's view.
To only have your markup output what you want to see on the page you should put a test around the group you want to show.
You should test if the current node in the loop is an ancestor or actually is the page you are on is. In your example, when the loop gets to the 'Testing' node, it'll test if you're on the Testing page, or a child of the Testing page, and if so, enter the next section to show the descendants.
I think level 3 is where you want to do the test in the example you give.
so
<xsl:iftest="count($parentNode/*[@isDoc and string(umbracoNaviHide)!='1']) > 0">
Sub Navigation
I have sub navigation within my site that displays all nav from levels 2 / 3 / 4 however the current XSLT I am using, which has been applied from another post on this forum, displays all nodes open. I need this to only show the descendants of the current node we are on. Here is my XSLT:
This displays as follows (apologies for the black lines - confidentiality and all that) but it gives an idea. I iodally just need to show one of these sections at a time. i.e When you click the node named 'Testing' then the other two nodes with arrows on them would not be expanded but the 'Testing' node and all of its children would be expanded. Any help greatly appreciated.
Hi
If the problem is only of expanding the menu then I personally recommend you jquery. Jquery provide such a functionality of toggling the menus. Here is one example http://www.sohtanaka.com/web-design/examples/toggle/
Hope this helps you
Pnima
Go with Pnima, jquery is really what you need.
There is a jquery plugin with name jquery.droppy. Use that one.
jQuery is great to dynamically do this, but it means the markup is still on the page, just hidden from the user's view.
To only have your markup output what you want to see on the page you should put a test around the group you want to show.
You should test if the current node in the loop is an ancestor or actually is the page you are on is. In your example, when the loop gets to the 'Testing' node, it'll test if you're on the Testing page, or a child of the Testing page, and if so, enter the next section to show the descendants.
I think level 3 is where you want to do the test in the example you give.
so
<xsl:if test="count($parentNode/*[@isDoc and string(umbracoNaviHide)!='1']) > 0">
becomes (untested - sorry)
<xsl:if test="$currentPage/@id = ./ancestor-or-self::*/@id">
<xsl:if test="count($parentNode/*[@isDoc and string(umbracoNaviHide)!='1']) > 0">
Sorry, I don't have the ability to test this at the moment, but I'm pretty sure it should work.
- Sean
is working on a reply...