This works fine and displays all the page links but I need to style/indent the parent page links
The structure of the page/ links is setup like below
Parent page
> Page 1 > Page 2 > Sub page > Sub page > Sub page
> Page 3
But at the moment all the links regardless of whether they are a parent page or sub page are just rendered out in the li tags, so I cant style/indent the parent pages
Hopefully that makes sense :o
Does anyone know how I can change the xslt to do this please?
One problem - it's listing all the site pages, I just want to list all the pages from the parent page. Kind of like the below:
> Parent page
> Page 1 > Page 2 > Sub page > Sub page > Sub page
> Page 3
I tried changing a few things in your xslt above but can't seem to get it working :(, I presume its something to do with changing siteroot to currentpage or?
On a side note would the sub nav still display all the links if you went into a child page for example?
Displaying pages/ subpage links in xslt
I am trying to list all pages/subpages of the parent page in a sidebar, this is what I have at the moment:
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- The fun starts here -->
<aside>
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=2]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
<xsl:for-each select="$currentPage/descendant::* [@isDoc and string(umbracoNaviHide) = '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</aside>
This works fine and displays all the page links but I need to style/indent the parent page links
The structure of the page/ links is setup like below
Parent page
> Page 1
> Page 2
> Sub page
> Sub page
> Sub page
> Page 3
But at the moment all the links regardless of whether they are a parent page or sub page are just rendered out in the li tags, so I cant style/indent the parent pages
Hopefully that makes sense :o
Does anyone know how I can change the xslt to do this please?
Thanks!
Hi Adam,
Here's the standard XSLT way of doing stuff like that:
It uses a single template to render the links, which will automatically process any child pages, wrapping them in a nested <ul> for styling.
Hope this helps,
/Chriztian
Hey Chriztian
Thanks for the reply!
One problem - it's listing all the site pages, I just want to list all the pages from the parent page. Kind of like the below:
> Parent page
> Page 1
> Page 2
> Sub page
> Sub page
> Sub page
> Page 3
I tried changing a few things in your xslt above but can't seem to get it working :(, I presume its something to do with changing siteroot to currentpage or?
On a side note would the sub nav still display all the links if you went into a child page for example?
Thanks!
is working on a reply...