Skip to content

Instantly share code, notes, and snippets.

@xpathr
Created May 10, 2012 14:40
Show Gist options
  • Select an option

  • Save xpathr/2653488 to your computer and use it in GitHub Desktop.

Select an option

Save xpathr/2653488 to your computer and use it in GitHub Desktop.
Alternative Navigation by rainerborene
<?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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment