Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have the following navigation structure:
I would like to be able to list the recipes on each recipe page so that the user can easily navigate from one to another.
I understand listing sub pages from a current page but can anyone point me in the direction of how to list sub pages on a sub page!
Many thanks,
Rachel
Hi Rachel
To list immediate child nodes you do something like this:
<xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'recipe']"/>
To go further down the content tree you have to extend the $curentpage/node query to include more, e.g. by adding more specifiers:
<xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'recipes']/node [@nodeTypeAlias = 'recipe']"/>
To include subchilds in any subpage you could do:
<xsl:for-each select="$currentPage/descendant::node [@nodeTypeAlias = 'recipe']"/>
Hope this helped
>Tommy
Rachel,
<xsl:for-each select="$currentPage/parent::node/node">...</xls:for-each>
should get you all subpages (Recipe x) from a subpage.
A great wiki page on xpath axis can be found here.
Hope this helps.
Regards,
/Dirk
depends on what you want to achieve. If you want to output a nested list use something like that:
<ul> <xsl:for-each select="$currentPage/node"> <li> <xsl:value-of select="@nodeName"/> <xsl:if test="count(node) > 0"> <ul> <xsl:for-each select="node"> <li> <xsl:value-of select="@nodeName"/> </li> </xsl:for-each> </ul> </xsl:if> </li> </xsl:for-each></ul>
Take a look into Doug's great introductions to xslt :
http://blog.percipientstudios.com/2009/4/11/anatomy-of-an-umbraco-xslt-file.aspx
http://blog.percipientstudios.com/2009/5/5/your-first-umbraco-xslt-macro.aspx
hth, Thomas
Thanks for all your speedy responses.
The code Dirk provided was exactly what I needed
<xsl:for-each select="$currentPage/parent::node/node">
and the Wiki page is a great resource, I'll also be reading up on Doug's introductions to xslt.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Listing sub pages on a sub page
Hi,
I have the following navigation structure:
I would like to be able to list the recipes on each recipe page so that the user can easily navigate from one to another.
I understand listing sub pages from a current page but can anyone point me in the direction of how to list sub pages on a sub page!
Many thanks,
Rachel
Hi Rachel
To list immediate child nodes you do something like this:
To go further down the content tree you have to extend the $curentpage/node query to include more, e.g. by adding more specifiers:
To include subchilds in any subpage you could do:
Hope this helped
>Tommy
Rachel,
should get you all subpages (Recipe x) from a subpage.
A great wiki page on xpath axis can be found here.
Hope this helps.
Regards,
/Dirk
depends on what you want to achieve. If you want to output a nested list use something like that:
Take a look into Doug's great introductions to xslt :
http://blog.percipientstudios.com/2009/4/11/anatomy-of-an-umbraco-xslt-file.aspx
http://blog.percipientstudios.com/2009/5/5/your-first-umbraco-xslt-macro.aspx
hth, Thomas
Thanks for all your speedy responses.
The code Dirk provided was exactly what I needed
and the Wiki page is a great resource, I'll also be reading up on Doug's introductions to xslt.
Many thanks,
Rachel
is working on a reply...