XSLT menu listing niveau 3 and 4

Topics: XSLT
Dec 30, 2010 at 6:40 PM

Need a little assistance with some XSLT again.

I'd like a menu that lists all pages on level 3, and when a page is selected it's level 4 children should be listed.
Basicly the standard multilevel submenu functionality, i my case level 3 and 4 in my page tree.

I just can't figure out what my functionscope should be to archieve this.

Can someone help out with an XSLT snippet and a tip :-)


Jan 2, 2011 at 10:05 PM

The XSLT below is copied from the OmniCorp demo site, it does exactly what you request - if you install this demo you can examine it in more detail, the XSLT Function is titled "Omnicorp.Navigation.Sub".

Beside from the XSLT below, the function does a call to Composite.Pages.SitemapXml (default parameters).

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="xsl in">
	<!-- this variable is inserted on the "Function Calls" tab -->
	<xsl:variable name="root" select="/in:inputs/in:result[@name='SitemapXml']"/>
	<!-- this variable is local to the stylesheet :) -->
	<xsl:variable name="section" select="$root/Page/Page[@isopen='true']"/>
	<xsl:template match="/">
					<a href="{$section/@URL}">
						<xsl:value-of select="$section/@MenuTitle"/>
					<xsl:apply-templates select="$section/Page"/>
	<xsl:template match="Page[@MenuTitle!='']">
			<a href="{@URL}">
				<xsl:if test="@iscurrent='true'">
					<xsl:attribute name="class">selected</xsl:attribute>
					<xsl:value-of select="@MenuTitle"/>
			<xsl:if test="@isopen='true' and Page">
					<xsl:apply-templates select="Page"/>


Marcus :)