Use XML Files to Drive Your Navigation Menu
Using an XML file to drive your navigation menu in SharePoint 2010 starts to get a little techie, but is actually accessible to any power user who's been granted the rights to use SharePoint Designer.
One of the nice things about using SharePoint’s AspMenu navigation menu is that it already understands how to do flyouts and menu styling, so you aren’t rolling your own navigation like you are with some of the other options.
You’re just providing an alternative data source instead of using SharePoint’s publishing site hierarchy data source.
The following steps walk you through the process of using an XML file to drive your navigation menu:
In SharePoint Designer 2010, create a new XML file by choosing File→All Files.
You can move this file to a document library where it can be version controlled.
Enter your navigation items into the file.
Your file needs to follow the sitemap convention for navigation menus, which nests sitemap nodes inside one another.
Open the Web Part page, page layout, or master page in SharePoint Designer 2010 where you want to create your new navigation menu.
Test this in a Web Part page first, and then move it into a page layout or master page after you test it.
Drag and drop the data source for your XML file onto your page.
In Design view, click the location in your file where you want to insert the data source and then click the Insert tab on the Ribbon.
Click the Data Source button in the Controls group and select the XML file. SharePoint Designer inserts the data source control into the page.
Right-click the data source and choose Properties from the contextual menu.
Set the XPath property on your data source to the following value:
This ensures that the root nodes in your file don’t display in the navigation control.
Drag and drop an AspMenu control onto your page from the toolbox.
The AspMenu control is in the SharePoint Server Controls group of the Ribbon.
You may find it’s easier to copy and paste the AspMenu control from the publishing master page than inserting the control from the toolbox. If you do that, make sure you give the menu a unique ID, such as MyCustomMenu.
Configure the properties for the AspMenu control as follows:
Set the DataSourceID property on the AspMenu control to match the data source you created in Step 4.
Set the StaticDisplayLevels property to 1.
Insert a DataBindings elements to map the items in your XML file to the menu.
Save your settings and refresh the page.
A SharePoint menu displays custom navigation items.
SharePoint’s navigation model is inherited directly from ASP.NET. Nothing is new or magical about how SharePoint handles site navigation. That means you have lots of options for customizing the navigation menus in SharePoint. In most cases, you either create a new navigation provider or a new data source while using one of the existing navigation menus to display the results.