RE: Paging using XSLT

Subject: RE: Paging using XSLT
From: "West, Wilson Y." <WWest01@xxxxxxxxxx>
Date: Mon, 30 Oct 2000 17:20:03 -0400 (EST)
I've done basically what you are asking. In bit's and pieces here's what
I've got: (you should probably focus on the IF statement)

<!--Set the paging characteristics - # of lines per page and page number-->
<!-- Set the number of records per page-->
<xsl:param name="recordsPerPage" select="50"/>

<!-- Page Number field -->
<xsl:param name="pageNumber"/>

<!--this performs the output in table format - the "if" does all of the
limiting work to show only 50 "records"-->
 <xsl:if test="position() &gt;= $recordsPerPage * number($pageNumber) and
position() &lt;= number($recordsPerPage * number($pageNumber) +
$recordsPerPage)">
   <!-- Each timekeeper is on a seperate row -->
   <xsl:element name="tr">
   <xsl:if test="position() mod 2 = 0">
	<xsl:attribute name="bgcolor">#ffffcc</xsl:attribute>
   </xsl:if>
      <!-- below shows the number of the item - for debug
      <xsl:element name="td">
	<xsl:value-of select="position()"/>
      </xsl:element>
      -->
      <xsl:element name="td">
         <!--  The name -->
            <xsl:value-of select="@name"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:value-of select="@title"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:attribute name="align">center</xsl:attribute>
         <xsl:value-of select="@breffdate"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:attribute name="align">center</xsl:attribute>
         <xsl:value-of select="@brrt01"/>
      </xsl:element>
      <xsl:element name="td">
         <xsl:attribute name="align">center</xsl:attribute>
         <xsl:value-of select="@brcur"/>
      </xsl:element>
   </xsl:element>   <!-- TK's tr -->
 </xsl:if>

<!-- some logic to show previous/next page links-->
<!--Previous page, only show if pageNumber>0-->
<xsl:if test="$pageNumber &gt; 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)-1"/></xsl:attribute>
		&lt;&lt; Previous Page 
	</xsl:element>
	&#160; &#160; &#160; &#160; 
</xsl:if>

<!-- Next page, do not show when at end() of listing -->
<xsl:if test="($timekeeperCount - ((1+number($pageNumber)) *
$recordsPerPage)) > 0">
	<xsl:element name="a">
		<xsl:attribute
name="href">?page=myxmlpage&amp;sort=<xsl:value-of
select='$sortField'/>&amp;pagenumber=<xsl:value-of
select="number($pageNumber)+1"/></xsl:attribute>
		Next page &gt;&gt;
	</xsl:element>
</xsl:if>
<!--end of page links-->
</center>
<!-- end of link logic-->

Hope this helps somewhat.
I'm sure there are better ways of doing this, but I am new at this, and I
inherited the XML schema, so it'll work for us for now. Would love to see a
more efficient way, though.

Wilson West
wwest01@xxxxxxxxxx
Sidley & Austin
312.843.4107

> -----Original Message-----
> From:	Bharat.Chintapally@xxxxxxxxxxxxxxxxx
> [SMTP:Bharat.Chintapally@xxxxxxxxxxxxxxxxx]
> Sent:	Monday, October 30, 2000 9:13 AM
> To:	XSL-List@xxxxxxxxxxxxxxxx
> Subject:	Paging using XSLT
> 
> Good Morning folks:
>           I am trying to use XSLT to present large amounts of XML data in
> HTML tables. I need to implement a paging mechanism to let users navigate
> to previous and next pages etc. Has anybody implemented such a paging
> mechanism. Any pointers will be greatly appreciated.
> 
> I am using MSXML in IE 5.5.
> 
> Thanks for the help
> -- bharat
> ---------------------------------------------------------------
> Bharat Chintapally
> CommerceQuest Inc.
> bharat.chintapally@xxxxxxxxxxxxxxxxx
> New Phone # 813-639-6478
> ---------------------------------------------------------------
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

------------------------------------------------------------------------------------------------------------

This e-mail is sent by a law firm and may contain information that is privileged or confidential.  If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread