Subject: Re: [xsl] Splitting data into smaller groups for HTML output. From: Mike Rumble <mike.rumble@xxxxxxxxx> Date: Mon, 31 Oct 2005 20:44:31 +0000 |
After a bit of playing around with the code, I've used your code to come up with this... <xsl:template match="sources"> <xsl:variable name="all-items" select="source"/> <xsl:variable name="num-groups" select="floor(((count($all-items)-1) div 5)+ 1)"/> <xsl:for-each select="$all-items[position() <= $num-groups]"> <xsl:variable name="p" select="position()"/> <ul> <xsl:variable name="items" select="$all-items[position() >= ($p - 1)*5 + 1 and position() <= $p*5]"/> <xsl:for-each select="$items"> <xsl:variable name="j" select="position()"/> <li><a href=""><xsl:attribute name="href"><xsl:value-of select="$items[$j]/url" /></xsl:attribute><xsl:value-of select="$items[$j]/title"/></a></li> </xsl:for-each> </ul> </xsl:for-each> </xsl:template> It works perfectly, giving the intended output just as I intended, so thanks for your help and code. Cheers, Mike.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Splitting data into small, Michael Kay | Thread | RE: [xsl] XSLT 2.0 : Deployment, Agnisys |
RE: [xsl] Splitting data into small, Michael Kay | Date | Re: [xsl] Idea to relax default ns , David Carlisle |
Month |