Created
September 16, 2010 12:12
-
-
Save nils-werner/582324 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<xsl:apply-templates select="/data/categories/entry[not(parent)]" /> | |
</ul> | |
<xsl:template match="categories/entry"> | |
<xsl:param name="path" select="''" /> | |
<li id="{title/@handle}"> | |
<a href="{$root}{$path}{title/@handle}/"> | |
<xsl:value-of select="title" /> | |
</a> | |
<xsl:if test="/data/categories/entry[parent/item/@handle = current()/title/@handle]"> | |
<ul> | |
<!-- recursively call all elements with parent-nodes pointing to current node --> | |
<xsl:apply-templates select="../entry[parent/item/@id = current()/@id]"> | |
<xsl:with-param name="path" select="concat($path,'/',title/@handle)" /> | |
</xsl:apply-templates> | |
</ul> | |
</xsl:if> | |
</li> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment