Skip to content

Instantly share code, notes, and snippets.

@uniquelau
Created August 15, 2012 19:20
Show Gist options
  • Save uniquelau/3362783 to your computer and use it in GitHub Desktop.
Save uniquelau/3362783 to your computer and use it in GitHub Desktop.
List Children
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!--
Title: List Children
By: Laurence Gillian, www.voodoobytes.co.uk
Last updated: 15th August, 2012
For latest version: [GIST]
-->
<!--
Really simple transform you can use for spitting out sub-pages on a given
node or in XSL speak, children! Modify this to suit your needs, by using
different templates you can easily match different document types.
An example of this is commented out at the bottom of this file.
-->
<xsl:template match="/">
<xsl:apply-templates select="$currentPage/child::* [@isDoc]" />
</xsl:template>
<xsl:template match="*">
<article>
<a href="{umb:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
</article>
</xsl:template>
<xsl:template match="BlogPost">
<article>
<a href="{umb:NiceUrl(@id)}">
<img src="{contentImage}" alt="{@nodeName}" />
</a>
</article>
</xsl:template>
<!--
Below we see how a template can match mulitple document types, on
the match attribute we have just added a pipe | between each doctypealias.
-->
<!--
<xsl:template match="FAQ | Toggle">
<article>
<h3><xsl:value-of select="contentHeader" /></h3>
<div class="toggle">
<xsl:value-of select="contentBody" disable-output-escaping="yes" />
</div>
</article>
</xsl:template>
-->
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment