Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Section Menu

This describes how to change the menu to show only only the current top-level entry and the documents beneath it.

Put this line in your page2xhtml.xsl:
<xsl:apply-templates select="xhtml:div[@id = 'menu']" mode="section"/>
where you want the section menu, and these matches near the bottom:

<xsl:template match="xhtml:div[@id = 'menu']" mode="section">
<xsl:if test="xhtml:div[@class='menublock-selected-1']/xhtml:div[@class='menublock-selected-2']|xhtml:div[@class='menublock-selected-1']/xhtml:div[@class='menublock-2']">
<xsl:apply-templates mode="section"/>

<xsl:template match="xhtml:div[@class='menublock-selected-1']" mode="section">
<xsl:apply-templates select="@*|node()" mode="section"/>

<xsl:template match="xhtml:div[@class='menublock-1']" mode="section"/>

<xsl:template match="xhtml:div[@class='menuitem-selected-1']|xhtml:div[@class='menublock-selected-1']/xhtml:div[@class='menuitem-1']" mode="section">
<div class="menuitem-selected-1">In This Section</div>

<xsl:template match="@*|node()" mode="section" priority="-1">
<xsl:apply-templates select="@*|node()" mode="section"/>

The first match copies the menu div if there is a a second level and passes the mode lower.
- Remove the xsl:if to always show the section menu even when there are no lower levels.

The second match copies the menublock-selected-1 div and passes the mode lower.
The third match removes the menublock-1s.

The fourth match changes the menuitem-1 to "In This Section".
- Make it an empty match if you do not want any title. You could add static text (like "In This Section") directly in your HTML, but it would not disappear if there were no lower documents.
- Remove this match if you want the title of the section to appear and be a link when on a lower document.
- Use <div class="menuitem-selected-1"><xsl:value-of select="."/></div> if you want the title to appear, but never as a link.

The fifth match copies everything else.

Some more work could change the class names to use different CSS than the regular menu so both can appear on the same page.

If you want to use this code in several page2xhtml.xsl files, put this code into common-section.xsl and use:
<xsl:import href="common-section.xsl"/>
and the placement line in your page2xhtml.xsl files. Using a separate file improves maintenance and code reuse.

<< Menu: Top-LevelMenu: Subpages >>

Contact Solprovider
Paul Ercolino