[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Splitting data into smaller groups for HTML output
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|