The following xslt hides and shows nested UI, from a certain level. Including the parent ul. The xslt was taken from another topic, and I've tweak (slighty) to get me this far.
If possible I would like to remove the current parent UL, but when I try none of the menu is displayed. I feel I may need to introduce additonal templates?
But I cannot work out how to get this to only show the child menu items related the current page. So when people is the current page, the menu would look like this:
I think I understand it now. Basically the items at the first level will always be the same, e.g.
people history something else ...
but you only want the sub tree to expand for the page people are currently on, so if I'm on the history page I'll get
people history - founding fathers - first steps - ... something else ...
You should be able to achieve that by extending the if test before you call the sub nodes, so instead of
<xsl:iftest="count(./node) > 0">
do something like
<xsl:iftest="count(./node) > 0 and ./@id = $currentPage/@id">
So basically build the child nodes if - there are any and - the id of the first level node the loop is currently processing is identical to the id of the current page.
It almost works, the correct sub pages are shown when clicking on history. But when I then click on say founding fathers, it only shows people and history. When I need to show:
history - founding fathers -plus any child pages - first steps
I had a similar thinking to you, where I would add a count and when greater then 0, create the menu. But I was thinking of using it with the xslt at the beginning of the thread. But to date, have not got it to work. Will keep trying.
Hide Parent UL
Hi All
The following xslt hides and shows nested UI, from a certain level. Including the parent ul. The xslt was taken from another topic, and I've tweak (slighty) to get me this far.
Example html:
Looking to get this:
Macro:
If possible I would like to remove the current parent UL, but when I try none of the menu is displayed. I feel I may need to introduce additonal templates?
Thanks in advance
Eddie
Hi Eddie,
what if you remove the recursive call from the match="node" template (aka get rid of this bit:
and start the call one level deeper or at a specific node? Not sure if I understand you correctly though.
Sascha
Hi Sascha
Unfortunately removing that section gives the opposite effect and produces:
It looks like I need to retain this part, and possibly call a second template. The following XSLT produces the correct mark-up:
But I cannot work out how to get this to only show the child menu items related the current page. So when people is the current page, the menu would look like this:
Or when History is the current page then the menu would look like:
Ideally I need the mark-up form the xslt in this thread, but with the show/hide effect produced from by the xslt in the opening message.
Any ideas on how to achive this?
Thanks again
Eddie
Hi Eddie,
I think I understand it now. Basically the items at the first level will always be the same, e.g.
people
history
something else
...
but you only want the sub tree to expand for the page people are currently on, so if I'm on the history page I'll get
people
history
- founding fathers
- first steps
- ...
something else
...
You should be able to achieve that by extending the if test before you call the sub nodes, so instead of
do something like
So basically build the child nodes if
- there are any and
- the id of the first level node the loop is currently processing is identical to the id of the current page.
Hope it works,
Sascha
Hi Sascha
It almost works, the correct sub pages are shown when clicking on history. But when I then click on say founding fathers, it only shows people and history. When I need to show:
history
- founding fathers
-plus any child pages
- first steps
I had a similar thinking to you, where I would add a count and when greater then 0, create the menu. But I was thinking of using it with the xslt at the beginning of the thread. But to date, have not got it to work. Will keep trying.
Thanks again for you help.
Eddie
is working on a reply...