I have a list of sectors and sub sectors, both of which have their own content as child nodes. And I'd like to have sector specific navigation to show links to the list of content when you are viewing the sector page or one of those content pages.
At the moment I'm using ancestor-or-self to display the sub navigation for the sectors. However this selects all the sectors above me not just my parent sector.
This is how I currently select the nav
<xsl:variable name="records" select="$currentPage/ancestor-or-self::Sector/* [@isDoc and string(umbracoNaviHide) != '1']" />
and my structure
sector -- content page -- sector a ---- content page a
How can I select only sector a when I'm in content page a or sector a page itself.
I think I may have caused confusion with my question again.
As I understand your code it will only give me the first child node under a sector. I want the first and closest parent sector to the child or the sector itself if in that page.
"parent or self" select page or closest parent
I have a list of sectors and sub sectors, both of which have their own content as child nodes. And I'd like to have sector specific navigation to show links to the list of content when you are viewing the sector page or one of those content pages.
At the moment I'm using ancestor-or-self to display the sub navigation for the sectors. However this selects all the sectors above me not just my parent sector.
This is how I currently select the nav
and my structure
sector
-- content page
-- sector a
---- content page a
How can I select only sector a when I'm in content page a or sector a page itself.
Can't you just use
which would only return the first from the list?
Cheers,
/Dirk
I think I may have caused confusion with my question again.
As I understand your code it will only give me the first child node under a sector. I want the first and closest parent sector to the child or the sector itself if in that page.
How about
which would traverse up the tree for 'Sector' documents and return the first one?
Cheers,
/Dirk
To list pages within a section of a web site, I used the following to find if I was either a "sector a" page or "content page a" page
and then use this sectionId to control which pages you list.
Richard's code helped me reach a solution
Then I just use $sector in place of $currentPage/ancestor-or-self::Sector
Thanks for the suggestions.
is working on a reply...