Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ian Penny 5 posts 25 karma points
    Nov 22, 2011 @ 22:28
    Ian Penny
    0

    XSLT Based Nav

    Good Evening.

    I am building a website for my work with multiple levels of navigation. and two seperate navigation locations.

    Top Nav [ horizontal] to configure this i have a variable onTopNav which is set to true if i want a page up there

    Side Nav [ vertical ] anything page where onTopNav has no value

    I am using an XSLT if to see if current page has sub nav items if so displays them:

    <xsl:if test="count($currentPage/* [@isDoc and string(onTopNav) = '' and string(umbracoNaviHide) != '1']) &gt; '0' ">

    If page has no sub pages then it displays parent navigation

    <xsl:if test="count($currentPage/* [@isDoc and string(onTopNav) = '' and string(umbracoNaviHide) != '1']) = '0' ">

    I am looking change the first if so that if all the sub pages match a DocType such as NewsItem then the parent navigation is rendered.

    Hope i am making myself clear.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 22, 2011 @ 23:56
    Lee Kelleher
    0

    Hi Ian,

    If you want to test for a specific document-type alias, you can use that instead of the * wildcard, like so:

    <xsl:if test="$currentPage/NewsItem[@isDoc and string(onTopNav) = '' and string(umbracoNaviHide) != '1']">

    (note that I've removed the "count" from the test, you don't really need it ... if there are any nodes, then the XSLT will treat that as true, otherwise false.)

    Hope that helps? Let us know if you have any other questions.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft