[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [newbie]use of xsl:if {RE: XSL to handle display mutiple
My solution was the same as Jeni's. We had different ways of selecting which item starts each page, and getting the next ($maxItemsPage -1) items, but the overall method and outcome is the same. I also had a couple of minor errors in my untested code sample. The corrected version is below. <!-- start a new table for item 1, 51, 101, 151, etc. --> <xsl:for-each select="$items[(position()+1) mod $maxItemsPage + 1 = 1]"> <xsl:variable name="currentPos" select="(position() - 1) * $maxItemsPage + 1"/> <table width="100%" border="1" cellspacing="0"> <tbody> <!-- start a new row for current item and the next 49 --> <xsl:for-each select="$items[position() >= $currentPos and position() < $currentPos + $maxItemsPage]"> <tr> <td> <xsl:value-of select="."/> <!-- or whatever --> </td> </tr> </xsl:for-each> </tbody> </table> <!-- output separator if we're not on the last item in the set --> <xsl:if test="$currentPos + $maxItemsPage > count($books)"> <div style='page-break-before: always'/> </xsl:if> </xsl:for-each> - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://www.skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|