I'm sorry, but I'm not sure I get what you're after.
Could you provide your code, and more information about what you're trying to achieve? If you're in a for-each loop and looping through the subpages already, then your parent would technically be your $currentPage, unless I'm misunderstanding your question.
So you're aiming for something like a top navigation? Provided that your nodes actually have doctypes like "Content" and "SubPage", then this should do the trick:
It applies the same template to both the Content page and its SubPage children, so they will all be listed in the same unordered list. Since I've used "ancestor-or-self" on $currentPage it'll only work if the current page is any of the ones you listed, but you can of course tweak it to work regardless of where you are on the site.
Thanks for your response - I tried what you have and it did work however this is my existing code and I'm creating a navigation but it's a tabbed navigation - refer to this for more info :http://unwrongest.com/projects/tabify/
I need the parent node to also be displayed not just the sub page within the navigation
I wish the editor for these forum posts would allow editing of code snippets without messing up all the formatting. Rich text editors and code snippets just don't mix well.
Get Top Level Node
Hi There,
I have a tree structure which follows like this:
Content
Sub Page
I'm using a xsl:for-each to list each sub page item in a UL however, I also need to list it's parent.
Example:
Content Sub Page Sub Page Sub Page
Hopefully there is enough information here.
All suggestions are welcome!
Hi Jordy, and welcome to the forums.
I'm sorry, but I'm not sure I get what you're after.
Could you provide your code, and more information about what you're trying to achieve? If you're in a for-each loop and looping through the subpages already, then your parent would technically be your $currentPage, unless I'm misunderstanding your question.
So you're aiming for something like a top navigation? Provided that your nodes actually have doctypes like "Content" and "SubPage", then this should do the trick:
It applies the same template to both the Content page and its SubPage children, so they will all be listed in the same unordered list. Since I've used "ancestor-or-self" on $currentPage it'll only work if the current page is any of the ones you listed, but you can of course tweak it to work regardless of where you are on the site.
Hi Dan,
Thanks for your response - I tried what you have and it did work however this is my existing code and I'm creating a navigation but it's a tabbed navigation - refer to this for more info :http://unwrongest.com/projects/tabify/
I need the parent node to also be displayed not just the sub page within the navigation
Here is my code and hopefully make sense
Ah, got it. Then this should work:
Oops, just realized that the final template in my example should of course include an @id:
I wish the editor for these forum posts would allow editing of code snippets without messing up all the formatting. Rich text editors and code snippets just don't mix well.
Hi Dan,
Again thanks for all your help - I did get this fixed in the end - a bit of a hack.
Here is the code
is working on a reply...