Copied to clipboard

Flag this post as spam?

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


  • Andraž 45 posts 65 karma points
    Jan 08, 2010 @ 08:53
    Andraž
    0

    Navigation

    I have one question about the xslt and the navigation menu.

    If i have a structure like this:

    - Home

              - About us

              - Our projects

    - Login

     

    And i have this code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        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="/">

    <!-- start writing XSLT -->

    <ul id="nav">
    <xsl:for-each select="$currentPage/ancestor::root/node [string(./data [@alias='umbracoNaviHide']) != '1']">
        <li>
            <xsl:if test="$currentPage/@id=current()/@id">
                <xsl:attribute name="class">Selected</xsl:attribute>
            </xsl:if>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute>
                <xsl:value-of select="@nodeName" />
            </a>
        </li>
    </xsl:for-each>

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(./data [@alias='umbracoNaviHide']) != '2']">
        <li>
            <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
                <xsl:attribute name="class">Selected</xsl:attribute>
            </xsl:if>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:attribute name="title"><xsl:value-of select="@nodeName" /></xsl:attribute>
                <xsl:value-of select="@nodeName" />
            </a>
        </li>
    </xsl:for-each>
    </ul>


    </xsl:template>

    </xsl:stylesheet>

     

    Of course the navigation looks like this:

    Home Login About us Our projects

     

    But how can i have just navigation for "Home", so without the "Login".

     

    Tnx

     

  • Jonas Eriksson 930 posts 1825 karma points
    Jan 08, 2010 @ 09:48
    Jonas Eriksson
    0

    Hi, use the property umbracoNaviHide. Add it to your document type, and then check it for the login page.

    Regards

    Jonas

  • Jonas Eriksson 930 posts 1825 karma points
    Jan 08, 2010 @ 09:55
    Jonas Eriksson
    0

    Also @alias='umbracoNaviHide']) != '2' is not correct, the umbracoNaviHide should be a true/false property and the correct use would be @alias='umbracoNaviHide']) != '1'

Please Sign in or register to post replies

Write your reply to:

Draft