Subnavi only for first textpage

Apr 18, 2009 at 10:56 PM
Hi there,
first of all, thanks for this great starter kit!
I created several textpages under the root node; some of them with subpages.
Whenever I click on a textpage, the subitems of the first textpage with subpages are shown;
the subnavi always shows the header of the first textpage in the navigation tree.
Is it possible to have more than one textpage with subpages?


Apr 20, 2009 at 9:27 AM
Hi Matthias,
Thanks for the feedback i'm glad you like it. I would appreciate if you would leave a review on the codeplex project page please if you have the time.

I am sorry i dont fully understand your question could you take some screenshots of your content tree in umbraco with some more explaination of what you are trying to achieve so I can help you out with this problem.

Many Thanks,
Apr 20, 2009 at 11:32 AM
Look at
It is a clean install of umbraco 4.0.1 and CWS 2.0.1.
I have added two Textpages, Textpage1 and Textpage2. Each has two subpages; Textpage1_1, Textpage1_2 and so on.
When you click on Textpage1, the subnavigation below the main navigation shows


  • About Umbraco
  • About this project
  • Textpage1_1
  • Textpage1_2
  • Textpage2_2
  • Textpage2_1
I expected the subnavigation to show only the subpages of the current selected page; so if i click on "About" it should show


  • About Umbraco
  • About this project
When i click on Textpage1, it should show


  • Textpage1_1
  • Textpage1_2
Meanwhile I found where the same problem is described. Is there any solution for this?


Apr 20, 2009 at 2:57 PM
OK Matthias,
This seems to be an XSLT bug. I will do some testing later on and give you a fix when it is ready.

I recommend you vote for the bug/issue so to ensure i get it fixed for V2.0.2

Apr 20, 2009 at 5:26 PM
Hi Matthias,
I have fixed this and you can see the resolution.

Apr 20, 2009 at 11:06 PM
thank you very much for your help! Great work.
Apr 29, 2009 at 3:01 PM
Applying that fix still doesnt make it work for me :-(
Apr 29, 2009 at 3:05 PM
Can you copy and paste the XSLT here please and let me know of your content structure please.

Apr 29, 2009 at 3:08 PM
Edited Apr 29, 2009 at 3:12 PM
Here's the current XSLT:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]><xsl:stylesheetversion="1.0"xmlns:xsl=""xmlns:msxml="urn:schemas-microsoft-com:xslt"xmlns:umbraco.library="urn:umbraco.library"exclude-result-prefixes="msxml umbraco.library"><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"><xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2 and @nodeTypeAlias = 'CWS_Textpage']" /><div class="secondaryNav"><h3><xsl:value-of select="$rootTextpageNode/@nodeName"/></h3><ul><xsl:for-each select="$rootTextpageNode/node"><li><xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"><xsl:attribute name="class"><xsl:text>selected</xsl:text></xsl:attribute></xsl:if><a href="{umbraco.library:NiceUrl(current()/@id)}"><span><xsl:value-of select="current()/@nodeName"/></span></a></li></xsl:for-each></ul></div></xsl:template></xsl:stylesheet>

Can someone plz explain how you can add code without having codeplex mess up the layout??!
Apr 29, 2009 at 3:14 PM
I am not sure you just need to copy and paste the code nto wrap [code] around it.

What is your content structure please?


---> About
---->----->Some page below about


Apr 29, 2009 at 3:18 PM
Currently its

--> about
Apr 29, 2009 at 3:25 PM
OK on what page is the subnavi a problem?!

Apr 29, 2009 at 7:11 PM
Its on the "Products" page... I expect prod1 and prod2 to be listed in SubNavi, but instead its empty... 
Apr 30, 2009 at 8:58 AM
Using the XSLT Visualizer, if I choose "About" the h3 and li-items gets generated, but if I choose "Products" the only html that gets generated is:
<div class="secondaryNav"><h3></h3><ul></ul></div>
Apr 30, 2009 at 9:09 AM
Solved this by changing the line to
<xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2]" />

Maybe I have messed up the document type, but I couldn't find any reference to CWS_TextPage. Besides, that test probably isn't needed. What this XSLT so far is missing (afaik) is a test for the "Hide from Nav" checkbox is selected.
Apr 30, 2009 at 9:22 AM
Glad you have figured it out, this is what CWS2 will help you to do get involved with your XSLT and start to understand what is going on.

It looks like your new Products page was not a CWS_Textpage document type hence it did not find it.

If you want help with the hide let me know, but i think it would be good practise to see if you can figure it out yourself to see if you can learn umbraco & XSLT.

Apr 30, 2009 at 9:27 AM
Hehe... I had that comming, didn't I? ;-)

Yea, I saw the test was in place in Navi.xslt, so I guess I'll figure it out.

Thanks for the CWS, it really got me going with Umbraco, without having to pay for ;-)
Apr 30, 2009 at 9:36 AM
Glad you found CWS to be a big help for you to learn Umbraco.

If you like CWS I recommend you suggest Umbraco and CWS to all your friends/collegues and if you have the time I would appreciate if you can leave a review for CWS here please


May 3, 2009 at 3:40 AM

I have the same problem as you were having. However, I am not nearly as technically skilled as you.
Sometimes I can learn the "rules" of how a site or page is put together by looking at the code, but this
is beyond me. Can you please explain to me exactly where that line of code goes? I am not finding the
line of code that you showed in your April 29, 10:08 AM post. Is the code located in the template of
the document type where the SubNavi is not showing? Do I have to replace another line of code or
insert the line that you provided into the "sidebar" section? Right now, the only line of code in that
section is:
<umbraco:Macro Alias="CWS_SubNavi" runat="server"></umbraco:Macro>

Sorry for the newbie question. Thanks in advance for any assistance.

(Extreme Newbie)
May 3, 2009 at 3:51 AM
ok, I think I found it - in the Developer section under "XSLT Files" -> "SubNavi.xslt"

If this is not correct, please let me know.

May 4, 2009 at 8:24 AM
Hi Diffie.

No need to appologize. We're all learning here :-)

Yes, you'll have to edit the SubNavi.xslt located under Developer section and XSLT-Files. I simply changed

[@level = 2 and @nodeTypeAlias = 'CWS_Textpage']


[@level = 2]

Good luck, and don't be afraid to ask.