Alternative Navigation
Alternative way to build a navigation menu
Description
Just use call-template and you’re done.
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:variable name="menu"> <item handle="home">Home</item> <item handle="about">About</item> <item handle="contact">Contact</item> </xsl:variable> <xsl:template name="navigation"> <ul class="grid_3 alpha nav"> <xsl:for-each select="exsl:node-set($menu)/*"> <li> <a href="{$root}/{@handle}/"> <xsl:if test="$current-page = @handle"> <xsl:attribute name="class">selected</xsl:attribute> </xsl:if> <xsl:value-of select="text()"/> </a> </li> </xsl:for-each> </ul> </xsl:template> </xsl:stylesheet>