Skip to content

Instantly share code, notes, and snippets.

@andrewminton
Last active August 29, 2015 14:12
Show Gist options
  • Save andrewminton/8a962b641bc95ea15387 to your computer and use it in GitHub Desktop.
Save andrewminton/8a962b641bc95ea15387 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="data">
<xsl:for-each select="entry">
<xsl:variable name="pos" select="position()"/>
<xsl:if test="position() mod 4 = 1">
<div class="panel">
<div class="wrapper">
<xsl:for-each select="//entry[position() >= $pos and position() <= $pos + 4]">
<p id="{$pos}"><xsl:value-of select="p"/></p>
</xsl:for-each>
</div>
</div>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment