Skip to content

Instantly share code, notes, and snippets.

@andrewminton
Last active August 29, 2015 14:12
Show Gist options
  • Save andrewminton/0cee18a46609a0ec80ef to your computer and use it in GitHub Desktop.
Save andrewminton/0cee18a46609a0ec80ef to your computer and use it in GitHub Desktop.
<data>
<entry>
<p>Project 1</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 2</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 3</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 4</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 5</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 6</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 7</p>
<content>This is some content</content>
</entry>
<entry>
<p>Project 8</p>
<content>This is some content</content>
</entry>
</data>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:apply-templates select="data" mode="group"/>
</xsl:template>
<xsl:template match="data" mode="group">
<xsl:for-each select="entry">
<xsl:variable name="pos" select="position()"/>
<xsl:apply-templates select="." mode="item"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="entry" mode="item">
<div class="item">
<h1><xsl:value-of select="p"/></h1>
<xsl:copy-of select="content"/>
</div>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment