This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: [newbie]use of xsl:if {RE: XSL to handle display mutiple pages}
- To: xsl-list at mulberrytech dot com
- Subject: Re: [newbie]use of xsl:if {RE: XSL to handle display mutiple pages}
- From: Mike Brown <mike at skew dot org>
- Date: Fri, 3 Nov 2000 15:06:23 -0700 (MST)
- Reply-To: xsl-list at mulberrytech dot com
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