Skip to content

Instantly share code, notes, and snippets.

@andrrr
Created December 12, 2011 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrrr/1467308 to your computer and use it in GitHub Desktop.
Save andrrr/1467308 to your computer and use it in GitHub Desktop.
Nested Cats Path
<xsl:template match="data">
<h1>My Page</h1>
<hr/>
<h3>My Breadcrumbs</h3>
<xsl:apply-templates select="nc-breadcrumbs/path"/>
</xsl:template>
<xsl:template match="nc-breadcrumbs/path">
<ul class="breadcrumbs">
<xsl:apply-templates select="item" />
</ul>
</xsl:template>
<xsl:template match="nc-breadcrumbs/path/item">
<li>
<xsl:choose>
<xsl:when test="position() = last()">
<xsl:attribute name="class">current</xsl:attribute>
<xsl:value-of select="." />
</xsl:when>
<xsl:otherwise>
<a href="{$root}/{$current-page}/{@handle}/">
<xsl:value-of select="." />
</a>
<xsl:text> &#8594; </xsl:text>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment