Copied to clipboard

Flag this post as spam?

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


  • Duffman 1 post 21 karma points
    Aug 24, 2010 @ 17:54
    Duffman
    0

    XSLT and document properties

    Hi,

     I have a navigation menu for my website, which is generated by the pages/structure of the website.

    I have this working however i have a yes/no property set in the document types to say if the page should be shown in the menu or not, however i cannot figure out how to do this. The alias for the property is called "showInNav".

    Can anyone help me? I have no idea using XSLT. XSLT shown below....

    Thanks.

    <ul id="navmenu">

    <xsl:for-each select ="$currentPage/ancestor-or-self::node[@level ='1']/descendant::node">

    <xsl:if test="not (contains(current()/@nodeName,'News'))">

    <xsl:if test="@level = 2">

    <xsl:if test="count(child::node) > 0">

    <li>

    <xsl:if test ="$currentPage/parent::node/@id = current()/@id">

    </xsl:if>

    <a href="{umbraco.library:NiceUrl(current()/@id)}">

    <xsl:value-of select="current()/@nodeName"/></a>

    <ul>

    <xsl:for-each select="current()/node">

    <li>

    <xsl:if test ="$currentPage/self::node/@id = current()/@id">

    </xsl:if>

    <a href="{umbraco.library:NiceUrl(current()/@id)}">

    <xsl:value-of select="current()/@nodeName"/></a>

    <ul>

    <li><a href="#">test</a></li>

    </ul>

    </li>

    </xsl:for-each>

    </ul>

    </li>

    </xsl:if>

    <xsl:if test="count(child::node) = 0">

    <li>

    <xsl:if test ="$currentPage/self::node/@id = current()/@id">

    <xsl:attribute name="class" >selected</xsl:attribute>

    </xsl:if>

    <a href="{umbraco.library:NiceUrl(current()/@id)}">

    <xsl:value-of select="current()/@nodeName"/></a>

    </li>

    </xsl:if>

    </xsl:if>

    </xsl:if>

    </xsl:for-each>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 24, 2010 @ 21:31
    Jan Skovgaard
    0

    Hi Duffman and welcome to the forum and the world of Umbraco :-)

    I think that the above example seems to be a bit overkill of what you are trying to do.

    I would recommend you have a look at the predefined XSLT navigation snippet, which can be found from the dropdown list, once you create a new XSLT file in Umbraco.

    It should give you what you want I think.

    When you want to show/hide pages I would urge you to rename your alias from "showInNav" to "umbracoNaviHide", which you can see is also what is being tested in the mentioned predefined XSLT snippet. It will make your life a bit more easy when working with umbraco.

    Hope this helps a bit?

    /Jan

     

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 25, 2010 @ 10:24
    Ismail Mayat
    0

    Duffman,

    http://our.umbraco.org/projects/website-utilities/cogworks-flexible-navigation is your friend, navigation package with documentation that does obey hide from nav.

    Regards

    Ismail 

Please Sign in or register to post replies

Write your reply to:

Draft