Copied to clipboard

Flag this post as spam?

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


  • Zachary Price 5 posts 71 karma points
    Dec 05, 2016 @ 22:43
    Zachary Price
    0

    Navigation & SubNavigation Association

    Hey guys! I've taken over development of U4.7.2 and I'm trying to figure out how the navigation if working within Umbraco. I have found XSLT files where I can add subNavigation headers within a drop-down nav setup as well as a comma-seperated line where I can change the name of the mainNavigation names but there must be some place where I can associate which subNav headers "associate" with which mainNav tabs.

    Also the site is setup to have links underneath each subNav header so I'm having difficulty trying to find the section to associate those as well. I am hoping that maybe some of you can help me understand the logic behind this to understand Umbraco better and I'm very willing to dig in to do so.

    Any assistance is greatly appreciated. Please see the screenshot below for an idea of the current setup.

    enter image description here

  • Zachary Price 5 posts 71 karma points
    Dec 05, 2016 @ 23:02
    Zachary Price
    0

    Here's the code for what I believe is the main navigation...

    <?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"
      xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
      xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
      xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
      xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      xmlns:exsl="http://exslt.org/common"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets" extension-element-prefixes="exsl">
      <xsl:output method="xml" omit-xml-declaration="yes" />
      <xsl:param name="currentPage" />
      <xsl:variable name="pageMode" select="/macro/mode" />
      <xsl:variable name="itemCount" select="/macro/count" />
      <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
      <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
      <xsl:variable name="searchMethodSTRlcase" />
      <xsl:variable name="searchSTRlcase" />
      <!-- belows var is the main tree for umbraco content -->
      <xsl:variable name="contentTree" select="umbraco.library:GetXmlNodeById('1098')" />
      <xsl:variable name="navItems" select="/macro/navItems" />
      <xsl:variable name="xmltmp">
        <xsl:element name="result"><xsl:call-template name="mainNavXML"></xsl:call-template></xsl:element>
      </xsl:variable>
      <xsl:template match="/">
        <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level = 1]">
          <!--find root node and traverse back up the document-->
          <xsl:variable name="rootNode" select="./@id" />
    
        </xsl:for-each>
    
    <!-- ======================================================================================================= -->
    <!-- =========================================== MAIN NAVIGATION =========================================== -->
    <!-- ======================================================================================================= -->
        <div id="top-nav">
          <ul>
            <li id="home-nav">
              <div id="logo"><a href="/">OneNet</a></div>
              <div class="dropdown">
                <div class="dropdown-link">&nbsp;</div>
    <!-- ============ QUICK PICKS ============ -->                    
                <div class="dropdown-menu">
                  <ul>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/</xsl:attribute>Home</a></li>
                    <li><a target="_blank"><xsl:attribute name="href">https://sharepoint.firstcommand.com/FirstReference/Pages/District%20Recruiting-RecruitingMainPage.aspx</xsl:attribute>Advisor Recruiting</a></li>
                    <li><a href="https://cp2.firstcommand.com/Citrix/XenApp/auth/login.aspx" target="_blank">Command Post</a></li>
                    <li><a href="https://crm.firstcommand.com/FCCRM/main.aspx" target="_blank">CRM</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/compensation-and-benefits/</xsl:attribute>Compensation &amp; Benefits</a></li>
                                  <li><a href="https://www2.firstcommand.com/acn/cms/wwc/search.do?method=search&#38;hideNavs=true" target="_blank">Find a Client</a></li>
                    <li><a href="https://sharepoint.firstcommand.com/firstreference/pages/default.aspx" target="_blank">First Reference</a></li>
                                  <li><a href="https://www2.firstcommand.com/onenet/formsonline/index.htm" target="_blank">Forms Online</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/home-office-resources/</xsl:attribute>Home Office Resources</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/legal-and-compliance/</xsl:attribute>Legal &amp; Compliance</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/marketing-tools/</xsl:attribute>Marketing Tools</a></li>
                    <li><a href="https://www2.firstcommand.com/acn/frs/frsGotoMainPage.do" target="_blank">Metric Reporting System</a></li>
                    <li><a target="_blank"><xsl:attribute name="href">https://sharepoint.firstcommand.com/Policies/Default.htm#PoliciesWelcome.htm</xsl:attribute>Policy &amp; Procedure Library</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/smc/social-media-center.aspx</xsl:attribute>Social Media Center</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/products-and-providers/</xsl:attribute>Products &amp; Providers</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/training-and-education/</xsl:attribute>Training &amp; Education</a></li>
                    <li><a target="_self"><xsl:attribute name="href">/onenet/videos/</xsl:attribute>Video</a></li>
                    <li><a href="https://www2.firstcommand.com/acn/rehost/login/gotoWealthStation.do" target="_blank">WealthStation</a></li>
                  </ul>
                </div>
                <img id="quick-picks-tab" src="/media/18320/quick-links-tab.png" alt="quick-picks-tab" />
              </div>
            </li>
            <xsl:for-each select="exsl:node-set($xmltmp)/result/nav">
              <xsl:choose>
                <xsl:when test="count(./link[./@subsection='Resources'])=0 and count(./link[./@subsection='Reports'])=0 and count(./link[./@subsection='Tools'])=0 and count(./link[./@subsection='Public Sites'])=0 and count(./link[./@subsection='Client Portals'])=0 and count(./link[./@subsection='Directories'])=0 and count(./link[./@subsection='Test'])=0">
                  <li>
                    <xsl:attribute name="class"><xsl:choose><xsl:when test="position()=1">first slide-nav</xsl:when><xsl:otherwise>slide-nav</xsl:otherwise></xsl:choose></xsl:attribute>
                    <a href="#">
                      <strong>
                        <xsl:value-of select="./@section" />
                      </strong>
                    </a>
                    <div>&nbsp;</div>
                  </li>
                </xsl:when>
                <xsl:otherwise>
                  <li>
                    <xsl:attribute name="class"><xsl:choose><xsl:when test="position()=1">first slide-nav</xsl:when><xsl:otherwise>slide-nav</xsl:otherwise></xsl:choose></xsl:attribute>
                    <a href="#">
                      <strong>
                        <xsl:value-of select="./@section" />
                      </strong>
                    </a>
    <!-- ===================================== -->
    <!-- =============== SUB NAV ============= -->
    <!-- ===================================== -->
                    <div>
                      <xsl:if test="count(./link[./@subsection='Resources'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Resources</strong></li>
                          <xsl:for-each select="./link[./@subsection='Resources']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ======================================================================================================= -->
    <!-- ==================================== ADDING CUSTOM SUB NAV HEADERS ==================================== -->
                      <xsl:if test="count(./link[./@subsection='Test'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Test</strong></li>
                          <xsl:for-each select="./link[./@subsection='Test']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ======================================================================================================= -->
                      <xsl:if test="count(./link[./@subsection='Legal'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Legal</strong></li>
                          <xsl:for-each select="./link[./@subsection='Legal']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ======================================================================================================= -->
                      <xsl:if test="count(./link[./@subsection='Compliance'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Compliance</strong></li>
                          <xsl:for-each select="./link[./@subsection='Compliance']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ======================================================================================================= -->
                      <xsl:if test="count(./link[./@subsection='Internal Audit'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Internal Audit</strong></li>
                          <xsl:for-each select="./link[./@subsection='Internal Audit']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ================================== END ADDING CUSTOM SUB NAV HEADERS ================================== -->
    <!-- ======================================================================================================= -->
                      <xsl:if test="count(./link[./@subsection='Reports'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Reports</strong></li>
                          <xsl:for-each select="./link[./@subsection='Reports']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ===================================== -->
                      <xsl:if test="count(./link[./@subsection='Tools'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Tools</strong></li>
                          <xsl:for-each select="./link[./@subsection='Tools']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                          <xsl:if test="count(./link[./@subsection='Directories'])!=0">
                          <li style="margin-top: 20px;" class="grid_5 category"><strong>Directories</strong></li>
                          <xsl:for-each select="./link[./@subsection='Directories']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                          </xsl:if>
                        </ul>
                      </xsl:if>
    <!-- ===================================== -->
                      <xsl:if test="count(./link[./@subsection='Public Sites'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Public Sites</strong></li>
                          <xsl:for-each select="./link[./@subsection='Public Sites']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
                      <xsl:if test="count(./link[./@subsection='Client Portals'])!=0">
                        <ul>
                          <li class="grid_5 category"><strong>Client Portals</strong></li>
                          <xsl:for-each select="./link[./@subsection='Client Portals']">
                            <xsl:sort select="./@name" />
                            <li class="grid_5">
                              <a>
                                <xsl:attribute name="target"><xsl:value-of select="./@target" /></xsl:attribute>
                                <xsl:attribute name="href"><xsl:value-of select="./@url" /></xsl:attribute>
                                <xsl:value-of select="./@name" />
                              </a>
                            </li>
                          </xsl:for-each>
                        </ul>
                      </xsl:if>
    <!-- ===================================== -->
                    </div>
                  </li>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:for-each>
            <li id="search-menu" class="last">
              <form id="search-box" method="get" name="gs" onSubmit="processSearch(this); return false;">
                <input name="a" class="search-txt" type="text" size="20" maxlength="256" id="search" value=" Search &#8230;" onblur="if(this.value=='') this.value=' Search &#8230;';" onFocus="if(this.value==' Search &#8230;') this.value='';" onkeyup="lookup(this.value);"/>
                <input type="image" class="search-btn" src="/media/6957/go-arrow.png" alt="Search &#187;"/>
                <input type="hidden" name="q" value="a1" />
                <div id="suggestions">&nbsp;</div>
              </form>
                        <ul id="account-links">
                            <li class="first"><a href="https://changeup.firstcommand.com/" target="_blank">Change Password</a></li>
                            <li><a href="https://www2.firstcommand.com/acn/rehost/logoff.do">Logout</a></li>
                            <li class="last"><a class="support" href="#footer">Support</a></li>
                        </ul>
            </li>
          </ul>
        </div>
      </xsl:template>
      <xsl:template name="mainNavXML">
        <xsl:variable name="navSections" select="umbraco.library:Split($navItems, ',')" />
        <xsl:for-each select="$navSections/value">
          <xsl:variable name="counter" select="1" />
          <xsl:variable name="navSection2Store" select="." />
          <nav>
            <xsl:attribute name="section"><xsl:value-of select="." /></xsl:attribute>
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Resources']">
                  <link subsection='Resources'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
    <!-- ======================================================================================================================= -->
    <!-- ==================================== ADDING CUSTOM SUB NAV HEADERS TO mainNavXML ====================================== -->
    <!-- ======================================================================================================================= -->
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Legal']">
                  <link subsection='Legal'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
    <!-- ======================================================================================================================= -->
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Compliance']">
                  <link subsection='Compliance'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
    <!-- ======================================================================================================================= -->
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Internal Audit']">
                  <link subsection='Internal Audit'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
    <!-- ======================================================================================================================= -->
    <!-- ======================================================================================================================= -->
    <!-- ======================================================================================================================= -->
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Reports']">
                  <link subsection='Reports'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Directories']">
                  <link subsection='Directories'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Tools']">
                  <link subsection='Tools'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Public Sites']">
                  <link subsection='Public Sites'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
            <xsl:for-each select="$contentTree/*">
              <xsl:variable name="navSection2match" select="umbraco.library:Split(./linkSection, ',')" />
              <xsl:variable name="subnav2Store" select="." />
              <xsl:for-each select="$navSection2match/value[translate(.,$upper,$lower)=translate($navSection2Store,$upper,$lower)]">
                <xsl:for-each select="$subnav2Store[./linkSubsection='Client Portals']">
                  <link subsection='Client Portals'>
                    <xsl:attribute name="url"><xsl:value-of select="./linkURL" /></xsl:attribute>
                    <xsl:attribute name="name"><xsl:value-of select="./linkName" /></xsl:attribute>
                    <xsl:attribute name="target"><xsl:value-of select="./linkTarget" /></xsl:attribute>
                  </link>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
          </nav>
    a    </xsl:for-each>
      </xsl:template>
    </xsl:stylesheet>
    
  • Zachary Price 5 posts 71 karma points
    Dec 05, 2016 @ 23:05
    Zachary Price
    0

    The problem is I have coded what I want in the page above but it doesn't show up :(

  • Zachary Price 5 posts 71 karma points
    Dec 05, 2016 @ 23:09
    Zachary Price
    0

    This is from a file called "showAllNav.xslt"

    <?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"
      xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
      xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
      xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
      xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      xmlns:exsl="http://exslt.org/common"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets" extension-element-prefixes="exsl">
      <xsl:output method="xml" omit-xml-declaration="yes"/>
      <xsl:param name="currentPage"/>
      <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
      <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
      <xsl:variable name="parentNodeLevel" select="$currentPage/parent::*/@level"/>
      <xsl:variable name="childrenNodeLevel" select="($currentPage/parent::*/@level)+1"/>
      <xsl:variable name="parentFolderID" select="$currentPage/parent::*/@id" />
      <xsl:variable name="currentNodeID" select="$currentPage/@id"/>
      <xsl:variable name="parentFolderNode" select="umbraco.library:GetXmlNodeById($parentFolderID)" />
      <xsl:variable name="masterParentNodeID" select="$parentFolderNode/parent::*/@id" />
      <xsl:variable name="masterParentNode" select="umbraco.library:GetXmlNodeById($masterParentNodeID)" />
      <xsl:variable name="parentchildrenNodeLevel" select="($currentPage/parent::*/@level)-1"/>
      <xsl:variable name="currentURL" select="umbraco.library:NiceUrl($currentPage/@id)" />
      <xsl:variable name="URLPath" select="umbraco.library:Split($currentURL,'/')" />
      <xsl:variable name="breadCrumbXML">
        <xsl:element name="result"><xsl:call-template name="renderBreadcrumbXML"></xsl:call-template></xsl:element>
      </xsl:variable>
      <xsl:template match="/">
        <!-- start writing XSLT -->
        <xsl:if test="$masterParentNode/@level!='1'">
          <ul id="left-nav-breadcrumb">
            <li>
              <!--<li class="breadcrumbMain">
                <p><xsl:value-of select="$parentFolderNode/@nodeName" /></p>
              </li>-->  
              <xsl:for-each select="exsl:node-set($breadCrumbXML)/result/nav">
                <xsl:choose>
                  <xsl:when test="./BC_level!=''">
    
                      <a>
                        <xsl:attribute name="href"><xsl:value-of select="./BC_url" /></xsl:attribute>
                        <xsl:value-of select="./BC_name" />
                      </a>
                      <xsl:if test="position()!=last()">&nbsp;/</xsl:if>
    
                  </xsl:when>
                  <xsl:otherwise>
                    <span class="mainBreadCrumbLink">
                      <a>
                        <xsl:attribute name="href"><xsl:value-of select="./BC_url" /></xsl:attribute>
                        <xsl:value-of select="./BC_name" />
                      </a>
                      <xsl:if test="position()!=last()">&nbsp;/</xsl:if>
                    </span>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:for-each>
            </li>
          </ul>
        </xsl:if>
        <div class="clear">&nbsp;</div>
        <ul id="left-nav-nav">
          <!-- find current level and find all the nodes attached to it -->
          <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level = 1]">
            <xsl:for-each select="./descendant-or-self::*[@id!='' and @id=$masterParentNodeID]">
              <!-- the master node does not exist. -->
              <xsl:for-each select="child::*[@id!='' and ./disableOnenetFolderDisplay!='1']">
                <!-- draw out main link -->
                <xsl:sort select="./orderPriority" />
                <xsl:choose>
                  <xsl:when test="./@level=2">
                    <!-- this is a root nav element. Only filter in the items proceeding that belongs to a parent -->
                    <xsl:if test="./@id=$parentFolderID and ./disableOnenetFolderDisplay!='1'">
                      <li class="menuLink">
                        <xsl:if test="./@id=$currentPage/@id">
                          <xsl:attribute name="class">active menuLink</xsl:attribute>
                        </xsl:if>
                        <xsl:call-template name="renderNav">
                          <xsl:with-param name="nodeType">mainNav</xsl:with-param>
                          <xsl:with-param name="nodeTree" select="." />
                        </xsl:call-template>
                      </li>
                      <xsl:for-each select="child::*[@id!='' and ./disableOnenetFolderDisplay!='1']">
                        <xsl:sort select="./orderPriority" />
                        <li class="menuLink">
                          <xsl:if test="./@id=$currentPage/@id">
                            <xsl:attribute name="class">active menuLink</xsl:attribute>
                          </xsl:if>
                          <xsl:call-template name="renderNav">
                            <xsl:with-param name="nodeType">mainNav</xsl:with-param>
                            <xsl:with-param name="nodeTree" select="." />
                          </xsl:call-template>
                        </li>
                      </xsl:for-each>
                    </xsl:if>
                  </xsl:when>
                  <xsl:otherwise>
                    <!-- ok, so we are not on a root nav...render the following nav -->
                    <xsl:if test="./disableOnenetFolderDisplay!='1'">
                      <li class="menuLink">
                        <xsl:if test="./@id=$currentPage/@id">
                          <xsl:attribute name="class">active menuLink</xsl:attribute>
                        </xsl:if>
                        <xsl:call-template name="renderNav">
                          <xsl:with-param name="nodeType">mainNav</xsl:with-param>
                          <xsl:with-param name="nodeTree" select="." />
                        </xsl:call-template>
                      </li>
                    </xsl:if>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:choose>
                  <xsl:when test="name()='Folder'">
                    <xsl:variable name="contentsubTree" select="umbraco.library:GetXmlNodeById(./@id)" />
                    <xsl:if test="@id=$parentFolderID and ./@level !='2'">
                      <li class="subTreeLink">
                        <ul>
                          <xsl:for-each select="$contentsubTree/*[./disableOnenetFolderDisplay!='1']">
                            <!-- grab content from sub tree -->
                            <xsl:choose>
                              <xsl:when test="./onenetTitleAltLink!=''">
                                <li>
                                  <xsl:if test="./@id=$currentPage/@id">
                                    <xsl:attribute name="class">active</xsl:attribute>
                                  </xsl:if>
                                  <xsl:call-template name="renderNav">
                                    <xsl:with-param name="nodeType">mainNav</xsl:with-param>
                                    <xsl:with-param name="nodeTree" select="." />
                                  </xsl:call-template>
                                </li>
                              </xsl:when>
                              <xsl:otherwise>
                                <li>
                                  <xsl:if test="./@id=$currentPage/@id">
                                    <xsl:attribute name="class">active</xsl:attribute>
                                  </xsl:if>
                                  <xsl:call-template name="renderNav">
                                    <xsl:with-param name="nodeType">mainNav</xsl:with-param>
                                    <xsl:with-param name="nodeTree" select="." />
                                  </xsl:call-template>
                                </li>
                              </xsl:otherwise>
                            </xsl:choose>
                          </xsl:for-each>
                        </ul>
                      </li>
                    </xsl:if>
                  </xsl:when>
                </xsl:choose>
              </xsl:for-each>
            </xsl:for-each>
          </xsl:for-each>
        </ul>
      </xsl:template>
      <xsl:template name="renderNav">
        <xsl:param name="nodeType" />
        <xsl:param name="nodeTree" />
        <xsl:choose>
          <xsl:when test="name()='Folder'">
            <p>
              <xsl:choose>
                <xsl:when test="./umbracoRedirect!=''">
                  <a target="_self">
                    <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl($nodeTree/@id)" /></xsl:attribute>
                    <xsl:choose>
                      <xsl:when test="./onenetTitleAltLink!=''">
                        <xsl:value-of select="$nodeTree/onenetTitleAltLink" />
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="$nodeTree/@nodeName" />
                      </xsl:otherwise>
                    </xsl:choose>
                  </a>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:choose>
                      <xsl:when test="./onenetTitleAltLink!=''">
                        <xsl:value-of select="$nodeTree/onenetTitleAltLink" />
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="$nodeTree/@nodeName" />
                      </xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
              </xsl:choose>
            </p>
          </xsl:when>
          <xsl:when test="name()='Hyperlink' and ./disableOnenetFolderDisplay!='1'">
            <p>
              <a>
                <xsl:attribute name="target"><xsl:value-of select="./onenetHyperlink_Target" /></xsl:attribute>
                <xsl:attribute name="href">
                  <xsl:choose>
                    <xsl:when test="./onenetHyperlink_MediaLink!=''">
                      <xsl:value-of select="umbraco.library:GetMedia(./onenetHyperlink_MediaLink, 0)/umbracoFile" />
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="./onenetHyperlink_Link" />
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:choose>
                  <xsl:when test="./onenetTitleAltLink!=''">
                    <xsl:value-of select="./onenetTitleAltLink" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="./onenetHyperlink_Title" />
                  </xsl:otherwise>
                </xsl:choose>
              </a>
            </p>
          </xsl:when>
          <xsl:otherwise>
            <p>
              <a target="_self">
                <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl($nodeTree/@id)" /></xsl:attribute>
                <xsl:choose>
                  <xsl:when test="./onenetTitleAltLink!=''">
                    <xsl:value-of select="./onenetTitleAltLink" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="$nodeTree/@nodeName" />
                  </xsl:otherwise>
                </xsl:choose>
              </a>
            </p>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>
      <xsl:template name="renderBreadcrumbXML">
        <!-- run loop to create breadcrumbs -->
        <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level = 1]">
          <xsl:variable name="contentTree" select="umbraco.library:GetXmlNodeById(./@id)" />
          <xsl:for-each select="./descendant-or-self::*[@id!='' and @level=2]">
            <xsl:variable name="rootFolderTree" select="umbraco.library:GetXmlNodeById(./@id)" />
            <xsl:for-each select="$URLPath/value">
              <xsl:variable name="mainNodeFolderMatch" select="translate(translate(.,$upper,$lower),'-',' ')" />
              <xsl:variable name="mainNodeMatch" select="translate(translate($rootFolderTree/@nodeName,$upper,$lower),'-',' ')" />
              <xsl:if test="$mainNodeFolderMatch=$mainNodeMatch">
                <nav>
                  <BC_ID><xsl:value-of select="$rootFolderTree/@id" /></BC_ID>
                  <BC_url><xsl:value-of select="umbraco.library:NiceUrl($rootFolderTree/@id)" /></BC_url>
                  <BC_name><xsl:value-of select="$rootFolderTree/@nodeName" /></BC_name>
                  <BC_altLink><xsl:value-of select="$rootFolderTree/onenetTitleAltLink" /></BC_altLink>
                </nav>
              </xsl:if>
            </xsl:for-each>
            <xsl:for-each select="$URLPath/value">
              <!-- find the first value -->
              <xsl:if test="position()!=last()">
                <xsl:if test="$contentTree/@nodeName = .">
                  <xsl:call-template name="drawBreadcrumb">
                    <xsl:with-param name="rootNodetoMatchTree" select="$rootFolderTree" />
                    <xsl:with-param name="breadCrumbPosition" select="position()" />
                  </xsl:call-template>
                </xsl:if>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </xsl:for-each>
      </xsl:template>
      <xsl:template name="drawBreadcrumb">
        <xsl:param name="breadCrumbPosition" />
        <xsl:param name="rootNodetoMatchTree" />
        <xsl:for-each select="$URLPath/value">
          <xsl:variable name="urlFoldername" select="." />
          <xsl:if test="position()&gt;$breadCrumbPosition">
            <xsl:variable name="urltomatch" select="translate(translate($urlFoldername,$upper,$lower),' ','-')" />
            <xsl:variable name="mainfolderRoot" select="translate(translate($rootNodetoMatchTree/@nodeName,$upper,$lower),' ','-')" />
            <xsl:if test="$urltomatch=$mainfolderRoot">
              <!-- ok...so we found the main element, now draw out the breadcrumbs -->
              <xsl:variable name="startPos" select="position()" />
              <xsl:for-each select="$URLPath/value">
                <xsl:variable name="urlFoldername2" select="." />
                <xsl:if test="position() &gt; $startPos and position()!=last()">
                  <xsl:for-each select="$rootNodetoMatchTree/descendant-or-self::*[@id!='']">
                    <xsl:variable name="folderNametoMatch" select="translate(translate(./@nodeName,$upper,$lower),' ','-')" />
                    <xsl:if test="$urlFoldername2=$folderNametoMatch">
                      <nav>
                        <BC_ID><xsl:value-of select="./@id" /></BC_ID>
                        <BC_level><xsl:value-of select="./@level" /></BC_level>
                        <BC_url><xsl:value-of select="umbraco.library:NiceUrl(./@id)" /></BC_url>
                        <BC_name><xsl:value-of select="./@nodeName" /></BC_name>
                        <BC_altLink><xsl:value-of select="./onenetTitleAltLink" /></BC_altLink>
                      </nav>
                    </xsl:if>
                  </xsl:for-each>
                </xsl:if>
              </xsl:for-each>
            </xsl:if>
          </xsl:if>
        </xsl:for-each>
      </xsl:template>
    </xsl:stylesheet>
    
  • Zachary Price 5 posts 71 karma points
    Dec 05, 2016 @ 23:11
    Zachary Price
    0

    Again what I'm assuming is that there must be a place where I'm supposed to associate the subNav headers to the mainNav tabs and then I'm not sure where or how to add the links (or any content) underneath the subNav headers.

    I feel that maybe if I knew how to ask for what I needed it would also help with my Googles. Thanks in advance for the help any and all.

Please Sign in or register to post replies

Write your reply to:

Draft