Skip to content

Instantly share code, notes, and snippets.

@designermonkey
Forked from iwyg/master.xml
Created May 24, 2012 13:58
Show Gist options
  • Save designermonkey/2781708 to your computer and use it in GitHub Desktop.
Save designermonkey/2781708 to your computer and use it in GitHub Desktop.
<data>
<pants>
<entry>
<content>Test 1</content>
</entry>
<entry>
<content>Test 2</content>
</entry>
<entry>
<content>Test 3</content>
</entry>
<entry>
<content>Test 4</content>
</entry>
<entry>
<content>Test 5</content>
</entry>
<entry>
<content>Test 6</content>
</entry>
<entry>
<content>Test 7</content>
</entry>
<entry>
<content>Test 8</content>
</entry>
<entry>
<content>Test 9</content>
</entry>
<entry>
<content>Test 10</content>
</entry>
<entry>
<content>Test 11</content>
</entry>
<entry>
<content>Test 12</content>
</entry>
<entry>
<content>Test 13</content>
</entry>
<entry>
<content>Test 14</content>
</entry>
</pants>
</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:apply-templates select="pants/entry[position() = 1 or ((position() - 7) mod 6 = 0)]" mode="row"/>
</xsl:template>
<xsl:template match="pants/entry" mode="col">
<li><xsl:value-of select="."/></li>
</xsl:template>
<xsl:template match="pants/entry" mode="row">
<aside><ul><xsl:apply-templates select=". | following-sibling::entry[1] | following-sibling::entry[2] | following-sibling::entry[3] | following-sibling::entry[4] | following-sibling::entry[5]" mode="col"/></ul></aside>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment