[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

Subject: Re: Splitting data into smaller groups for HTML output.
From: Mike Rumble <mike.rumble@xxxxxxxxx>
Date: Mon, 31 Oct 2005 20:44:31 +0000
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() &lt;= $num-groups]">
		<xsl:variable name="p" select="position()"/>
 		<ul>
    		<xsl:variable name="items" select="$all-items[position() &gt;=
($p - 1)*5 + 1 and position() &lt;= $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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.