Hi DNN Experts,
I hope you can help me out with something I need to customize at my left sidebar DDRMenu. I've got it configured using the xslt template mechanism. My main menu is a DDNGo megamenu configured like:
Sub product A-1 / Sub product A-2 / Sub product A-3
product A-1-1 Product A-2-1 Product A-3-1
product A-1-2 Product A-2-2 Product A-3-2
If I click main menu item "ProductCategoryA" my sidebar needs to list "Sub product A-1" , "Sub product A-2" and "Sub product A-3". Now if I click "Sub product A-1" it should list "Product A-1-1" and "Product A-1-2". As soon as I click product A-1-2 it should list "product A-1-2-1" and "product A-1-2-2", but if I click "Product A-1-1" having no child items, it should actually list "Product A-1-1" and "Product A-1-2" (so all items under the parent node unstead of nothing).
In short: As soon as my main menu opens a menu item without child items, the left sidebar should show it's parents child items instead of nothing (no children). If there are child items it should list them instead.
Now I've got the nodeselector as 0,0,0. I believe the template is only called for the current node? So I'm thinking to set the nodeselector to -3,0,0 to have it always pass all menu items to the template.
Now within the template I believe I could check with:
<xsl:when test="count(../*) > 0">
<span>We've got nodes on this page, so show them</span>
<span>We don't have nodes, call <xsl:apply-templates select="parent::parent::node()"> to list grandparent nodes instead?
However, this would list all menu items and not only those as of the current page level. I think my question is: How could I check the current selected menu item node within the nodelist? Would this be @selected? In that case I could loop all nodes untill I reach the @selected node, count items for that node and load grandparent nodes instead if it is 0?
Am I on the right track here or is there a way better solution?