Created
April 29, 2010 19:08
-
-
Save nickdunn/384074 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
<xsl:template match="data"> | |
<xsl:variable name="number-of-entries" select="count(my-datasource/entry)"/> | |
<xsl:variable name="per-column" select="ceiling($number-of-entries div 3)"/> | |
<xsl:for-each select="my-datasource/entry[position() mod ($per-column - 1)]"> | |
<xsl:variable name="position" select="position()"/> | |
<xsl:variable name="start" select="($per-column * $position) - ($per-column - 1)"/> | |
<xsl:variable name="end" select="($per-column * $position)"/> | |
<xsl:variable name="entries" select="/data/my-datasource/entry[position() >= $start and position() <= $end]"/> | |
<xsl:if test="$entries"> | |
<ul> | |
<xsl:apply-templates select="$entries" mode="list-item"/> | |
</ul> | |
</xsl:if> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="entry" mode="list-item"> | |
<li>...</li> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment