I am trying to find a suitable package for site navigation, specifically left vertical navigation.I so far have tried COG Navigation, which seemed okay, however, I found that some pages had the correct navigation and then others were missing certain parts of the navigation. I was unable to figure out why, so I've been forced to look for other options.Currently, I am trying to follow the instructions for a navigation built with an XSLT file.Problem I am having with this one is that it's not populating any type of navigation.My macro is as follows:<umbraco:Macro Alias="LeftNavigation" runat="server" />My XSLT file is as follows:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><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"/><!-- Input the documenttype you want here --><xsl:variable name="level" select="1"/><xsl:template match="/"><!-- The fun starts here --><ul><xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li></xsl:for-each></ul></xsl:template></xsl:stylesheet>Thank you in advance!
I am not sure what you trying to do here. To me the code you have posted, is just fine. It will give you an menu of level 1 items, if your site structure is like this and so on.
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="class">selected</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet>
If I have misunderstood you don't hesitate to write again, and then I would try to help you.
Sorrry that I don´t understand what you´re trying to. Are you trying to pull out level 2 navavigation for a left side menu or?
What do you mean by however, it is NOT populating the navigation? Can you maybe share you content structure and from there describe what nodes you want to display.
Okay I assume that it a section that live side by side with the home page. If that is the case I think that you could use this code snippet.
In this script you get XML from a specific node, and gets it´s childs nodes. So you have to enter the node id for The Saint Leo node, the id can you find under the properties tab, or by hover the node, and the id will be showing on the left conor of the UI. The documentation can be found here: http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
Ahh new I see why this is going wrong. Yon can´t just run XSLT code in a template. You will have to create an XSLT file, from umbraco and the place the macro into your page.
First go to the developer section then click on the XSLT folder click create, and then give it a name remember to set it to create a maco as wll.
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:variable name="locationsRoot"select="umbraco.library:GetXmlNodeById(1234)"/>
Sorry for the late answer, jep you have to update the ID (1234) so it match in your case.
You have to enter the node id for The Saint Leo node, the id you can find under the properties tab for the node, or by hover the node, and the id will be showing on the left conor of the UI. The documentation for using the GetXmlNodeById method can be found here: http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:variable name="locationsRoot"select="umbraco.library:GetXmlNodeById(1334)"/>
Umbraco Navigation
I am trying to find a suitable package for site navigation, specifically left vertical navigation.I so far have tried COG Navigation, which seemed okay, however, I found that some pages had the correct navigation and then others were missing certain parts of the navigation. I was unable to figure out why, so I've been forced to look for other options.Currently, I am trying to follow the instructions for a navigation built with an XSLT file.Problem I am having with this one is that it's not populating any type of navigation.My macro is as follows:<umbraco:Macro Alias="LeftNavigation" runat="server" />My XSLT file is as follows:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><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"/><!-- Input the documenttype you want here --><xsl:variable name="level" select="1"/><xsl:template match="/"><!-- The fun starts here --><ul><xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li></xsl:for-each></ul></xsl:template></xsl:stylesheet>Thank you in advance!
Hi Jason,
I am not sure what you trying to do here. To me the code you have posted, is just fine. It will give you an menu of level 1 items, if your site structure is like this and so on.
--Home
---Item1
----- Item 1.1
----- Item 1.2
---Item2
---Item3
If I have misunderstood you don't hesitate to write again, and then I would try to help you.
Looking forward to hear from you.
/Dennis
I thought it looked correct also, however, it is NOT populating the navigation. I tried changing the level number is still got nothing.
Any suggestions? I don't see many Umbraco navigation tools out there.
I have to get it fixed as soon as possible.
Thanks,
Hi Jason,
Sorrry that I don´t understand what you´re trying to. Are you trying to pull out level 2 navavigation for a left side menu or?
What do you mean by however, it is NOT populating the navigation? Can you maybe share you content structure and from there describe what nodes you want to display.
So much information you can give, is better.
Looking forward to hear from you.
/Dennis
Umbraco structure for this area:
Left Navigation for this area is "supposed" to look like this:
With "current" code, looks like this:
I thought the images might help since I don't explain it very well. :-(
Hi Jason,
Okay I assume that it a section that live side by side with the home page. If that is the case I think that you could use this code snippet.
In this script you get XML from a specific node, and gets it´s childs nodes. So you have to enter the node id for The Saint Leo node, the id can you find under the properties tab, or by hover the node, and the id will be showing on the left conor of the UI. The documentation can be found here: http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
Maybe this is not the best practice solution, but I hope this will work for you.
/Dennis
Hi Dennis,
I'm assuming I change the (1234) to the appropriate node?
If so, I did, but am still not seeing a nav.
Here is the code from the page's master file where I dropped the code:
<%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageStyles" runat="server">
<style>
#scenic-bg
{
background-color: #<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundColor") %>;
background-image: url(<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundImage") %>);
background-position: 50% 0;
background-repeat: no-repeat;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageScripts" runat="server">
<umbraco:Item Field="pageScripts" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BackgroundScene" runat="server">
<div id="scenic-bg">
<%#UmbracoItem.Eval("ancestor-or-self::* [@level='2']/scenicBackgroundColor")%>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<div id="page-body" class="inner standard">
<div id="primary-content">
<div class="detail">
<Crumb:UmbracoBreadcrumbMenu CssId="breadcrumb-navigation" ShowRootNode="true" RootNodeTitle="Home" ShowCurrentNode="true" LinkCurrentNode="false" ID="breadcrumb" runat="server"></Crumb:UmbracoBreadcrumbMenu>
<h1 class="tk-ff-meta-web-pro"><%= (!UmbracoItem.IsNullOrEmpty("alternatePageHeading") ? UmbracoItem.Get("alternatePageHeading") : UmbracoItem.PageName)%></h1>
<% if (!UmbracoItem.IsNullOrEmpty("introCopy"))
{ %>
<p class="intro"><umbraco:Item ID="Item3" Field="introCopy" runat="server" /></p>
<umbraco:Item Field="subIntroCopy" runat="server" />
<% } %>
<% if (!UmbracoItem.IsNullOrEmpty("introCopy")) { %>
<hr class="star" />
<% } %>
<umbraco:Item Field="bodyCopy" runat="server" />
</div>
</div>
<div id="sidebar-left" class="aside">
<div class="nav">
<h2 class="<%=Convert.ToString(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName")).Replace(' ','-').Replace("&","and").ToLower() %>"><a href="<%=umbraco.library.NiceUrl(Convert.ToInt32(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@id"))) %>"><%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName") %></a></h2>
<div id="secondary-navigation">
<xsl:variablename="locationsRoot"select="umbraco.library:GetXmlNodeById(1334)"/>
<ul>
<xsl:for-eachselect="$locationsRoot/*[@isDoc and string(umbracoNaviHide) != '1']]">
<li>
<ahref="{umbraco.library:NiceUrl(@id)}">
<xsl:value-ofselect="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
<style type="text/css">
.slider-wrapper { position: absolute; left: 143px; top: 887px; }
.soundslide { position: absolute; left: 198px; top: 114px; }
.slider-overlay { position: absolute; top: 100px; left: 100px; /* example */
</style>
<div class="slider-wrapper">
<div class="soundslide">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="418" height="264" id="soundslider"><param name="movie" value="http://online.saintleo.edu/HowOnlineLearningWorks/publish_to_web/soundslider.swf?size=1&format=xml" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="bgcolor" value="#FFFFFF" /><embed src="http://online.saintleo.edu/HowOnlineLearningWorks/publish_to_web/soundslider.swf?size=1&format=xml" quality="high" bgcolor="#FFFFFF" width="418" height="264" menu="false" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash"></embed></object>
</div>
<img class="slider-overlay" src="http://online.saintleo.edu/images/laptop-bg.png" style="width: 620px; height: 347px;" />
</div>
</div>
</asp:Content>
Hi Jason,
Ahh new I see why this is going wrong. Yon can´t just run XSLT code in a template. You will have to create an XSLT file, from umbraco and the place the macro into your page.
First go to the developer section then click on the XSLT folder click create, and then give it a name remember to set it to create a maco as wll.
Here is a video about how to create an XSLT file. http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/creating-your-first-xslt-macro.aspx?ref=fromInstaller. Don´t hang into the code he are showing. It´s the old schema.
Here are some documentation about macros: http://our.umbraco.org/documentation/reference/templating/macros/ and here specific for XSLT macros: http://our.umbraco.org/documentation/reference/templating/macros/xslt/
Here is a video about what macros is: http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/what-are-macros
Hope this helps you, to give you a better understanding on XSLT.
/Dennis
Okay, I'm still learning so please bear with me.
I created the XSLT file and placed the macro within the template.
I'm getting: "Error Reading XSLT file" where the nav should be.
I think maybe my XSLT file is missing something?
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:variable name="locationsRoot"select="umbraco.library:GetXmlNodeById(1234)"/>
<ul>
<xsl:for-each select="$locationsRoot/*[@isDoc and string(umbracoNaviHide) != '1']]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul
Hi Jason,
Yeah you´re missing some of the top and button of the file. Try this one an see how it goes.
Hope this helps,
/Dennis
Thanks! I hope this works.
Which "snippet" do I choose when creating the macro?
And do you want me to replace the node #?
You have it as (1234)
Hi Jason,
Sorry for the late answer, jep you have to update the ID (1234) so it match in your case.
You have to enter the node id for The Saint Leo node, the id you can find under the properties tab for the node, or by hover the node, and the id will be showing on the left conor of the UI. The documentation for using the GetXmlNodeById method can be found here: http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
Hope this helps,
/Dennis
Hi Dennis,
When creating the macro, it askes you to select a "snippet".
Which one shoudl I select?
Thanks as always!
Hi Jason,
Just choose the clean one, and then try post my code, from one of the previous post into it.
And then hopefully you should get some data out.
/Dennis
Hi Dennis & Jan,
My aplogies for the delay, I have been trying to sort this out without bothering you. Unfortunately, I haven't had any luck. Could you help?
As of now, I am getting the error "Error reading XSLT file: "
Below are the following:
1.) Contents of template that I am testing Nav on.
2.) Contents of XSLT file
3.) Screenshot of Macro
-------------------------------------------------------
Template:
<%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageStyles" runat="server">
<style>
#scenic-bg
{
background-color: #<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundColor") %>;
background-image: url(<%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/scenicBackgroundImage") %>);
background-position: 50% 0;
background-repeat: no-repeat;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageScripts" runat="server">
<umbraco:Item Field="pageScripts" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BackgroundScene" runat="server">
<div id="scenic-bg">
<%#UmbracoItem.Eval("ancestor-or-self::* [@level='2']/scenicBackgroundColor")%>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<div id="page-body" class="inner standard">
<div id="primary-content">
<div class="detail">
<Crumb:UmbracoBreadcrumbMenu CssId="breadcrumb-navigation" ShowRootNode="true" RootNodeTitle="Home" ShowCurrentNode="true" LinkCurrentNode="false" ID="breadcrumb" runat="server"></Crumb:UmbracoBreadcrumbMenu>
<h1 class="tk-ff-meta-web-pro"><%= (!UmbracoItem.IsNullOrEmpty("alternatePageHeading") ? UmbracoItem.Get("alternatePageHeading") : UmbracoItem.PageName)%></h1>
<% if (!UmbracoItem.IsNullOrEmpty("introCopy"))
{ %>
<p class="intro"><umbraco:Item ID="Item3" Field="introCopy" runat="server" /></p>
<umbraco:Item Field="subIntroCopy" runat="server" />
<% } %>
<% if (!UmbracoItem.IsNullOrEmpty("introCopy")) { %>
<hr class="star" />
<% } %>
<umbraco:Item Field="bodyCopy" runat="server" />
</div>
</div>
<div id="sidebar-left" class="aside">
<div class="nav">
<h2 class="<%=Convert.ToString(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName")).Replace(' ','-').Replace("&","and").ToLower() %>"><a href="<%=umbraco.library.NiceUrl(Convert.ToInt32(XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@id"))) %>"><%=XPathBinder.Eval(UmbracoItem.CurrentPage, "ancestor-or-self::* [@level='2']/@nodeName") %></a></h2>
<div id="secondary-navigation">
<umbraco:Macro Alias="Navigation" runat="server" />
</div>
</div>
</div>
<style type="text/css">
.slider-wrapper { position: absolute; left: 143px; top: 887px; }
.soundslide { position: absolute; left: 198px; top: 114px; }
.slider-overlay { position: absolute; top: 100px; left: 100px; /* example */
</style>
<div class="slider-wrapper">
<div class="soundslide">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="418" height="264" id="soundslider"><param name="movie" value="http://online.saintleo.edu/HowOnlineLearningWorks/publish_to_web/soundslider.swf?size=1&format=xml" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="bgcolor" value="#FFFFFF" /><embed src="http://online.saintleo.edu/HowOnlineLearningWorks/publish_to_web/soundslider.swf?size=1&format=xml" quality="high" bgcolor="#FFFFFF" width="418" height="264" menu="false" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash"></embed></object>
</div>
<img class="slider-overlay" src="http://online.saintleo.edu/images/laptop-bg.png" style="width: 620px; height: 347px;" />
</div>
</div>
</asp:Content>
XSLT File:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<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:Examine="urn:Examine" xmlns:umbraco.contour="urn:umbraco.contour"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine umbraco.contour ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
<!-- Use div elements around this macro combined with css -->
<!-- for styling the navigation -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<ul>
<xsl:variable name="locationsRoot"select="umbraco.library:GetXmlNodeById(1334)"/>
<ul>
<xsl:for-each select="$locationsRoot/*[@isDoc and string(umbracoNaviHide) != '1']]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Macro:
Jan & Dennis,
Please let me know if I should post more information or if I didn't explain enough.
Thank you both for your help, I truly appreciate it.
Sincerely,
Navigation is still not showing up.
If anyone could assist, I would greatly appreciate it!
is working on a reply...