Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:41:06+00:00 2026-06-09T03:41:06+00:00

I have a Content tree in Umbraco where I have 3 main pages with

  • 0

I have a Content tree in Umbraco where I have 3 main pages with their subpages. I also have 5 other pages that are child of Homepage which they have 2 options set: umbIsChildOfHomePage = 1 and umbracoNaviHide = 1
Take a look at structure:
enter image description here

Now: I want to generate a umb2ndLevelNavigation for each page.

I have this in my xslt file

<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
    <xsl:if test="count($items) &gt; 0">
        <ul>
            <xsl:for-each select="$items">
                <li>
                    <xsl:if test="position() = last()">
                        <xsl:attribute name="class">last</xsl:attribute>
                    </xsl:if>
                    <xsl:if test="position() = 1">
                        <xsl:attribute name="class">first</xsl:attribute>
                    </xsl:if>
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:if>

which will work only for pages other than homepage.
So need to extra personalize xslt select. How do I do that?
This is what I tried. I appended it to the template because I dont’t know how to append the condition in other select.

<xsl:variable name="itemsHomepage" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 1]/* [@isDoc and string(umbracoNaviHide) = '1' and string(umbIsChildOfHomePage) = 1]"/>
    <xsl:if test="count($itemsHomepage) &gt; 0">
        <ul>
            <!--<xsl:attribute name="class">
               a<xsl:value-of select="$currentPage/parent::*[@isDoc]/@id [string(umbIsChildOfHomePage) = 1 ]" />
            </xsl:attribute>-->
            <xsl:for-each select="$itemsHomepage">
                <li>
                    <xsl:if test="position() = last()">
                        <xsl:attribute name="class">last</xsl:attribute>
                    </xsl:if>
                    <xsl:if test="position() = 1">
                        <xsl:attribute name="class">first</xsl:attribute>
                    </xsl:if>
                    <xsl:choose>
                        <xsl:when test="name() = 'Link'">
                            <a href="{current()/linkUrl}" target="_blank">
                                <xsl:value-of select="@nodeName" />
                            </a>

                        </xsl:when>
                        <xsl:otherwise>
                            <a href="{umbraco.library:NiceUrl(@id)}">
                                <xsl:value-of select="@nodeName" />
                            </a>
                        </xsl:otherwise>
                    </xsl:choose>
                </li>
            </xsl:for-each>
            <!--<li>
                s:<xsl:value-of select="$currentPage/@id" />
                <xsl:value-of select="$RootNode/@nodeName"/>-<xsl:value-of select="$RootNode/@id"/>
            </li>-->
        </ul>
    </xsl:if>

The issue is that even if I go to a page that does not have childs items of homepage will be shown even for a page that does not have childs.
How do I personalize the select to show only when a page that have those 2 parameters(showNavi, and isHomePageChild) set on true?
Thanks for your help.
Hope you understood the issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:41:07+00:00Added an answer on June 9, 2026 at 3:41 am

    The initial code is targeting the nodes from the top down to level ‘2’ – which sounds correct for what you want, you just need to get it to render out

    There’s a good example here of what you are trying to do.

    Stripped that solution down ($level is set to 2) reminds me why I won’t go near xslt again willingly!:

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
    <xsl:if test="$currentPage/@id = current()/@id or $currentPage/../@id = current()/@id or $currentPage/../../@id = current()/@id">
    
    ...
    
    <ul>
    <!-- 1st navigation items -->
    <xsl:for-each select="./child::* [@isDoc and string(umbracoNaviHide) != '1']">
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"></xsl:if>
    <li> .... </li>
    
    <!--output 2nd level nevigation items -->
    <xsl:if test="count(current()/child::* [@isDoc]) &gt; 0 and $currentPage/@id = current()/@id or $currentPage/../@id = current()/@id or $currentPage/../../@id = 
    current()/@id">
    
    <ul>
    <!--output 3rd level nevigation items -->
    <xsl:for-each select="./child::* [@isDoc and string(umbracoNaviHide) != '1']">
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"></xsl:if>
    <li> ... </li>
    

    and so on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have in umbraco a content tree with pages to be displayed in navigation
I have content management system application that uses a polymorphic tree table as the
Situation: Imagine that I have an item(page) located at 'sitecore/Content/Home/mypage' in my content tree.
I have content on my page in boxes. They are displayed like this. Box1
I have content that is being dynamically generated. How to I listen to a
I have content on a webpage which is both sent from the server at
I have a content div that surrounds all my content, a navigation div and
I have a content page(Say.. invoice.aspx) in asp.net application with master pages. The content
i have a .net user control to add some opinions nodes to umbraco content
I used to think that folders needed to have an extension so that they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.