[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Paging using XSLT

Subject: RE: Paging using XSLT
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 3 Nov 2000 14:37:31 -0400 (EST)
javascript moveto
It's certainly possible to do an XSLT transformation that outputs an HTML
representation of records M to N of your data set, where M and N are defined
by parameters supplied to the stylesheet. For example, you can do something
like

<xsl:param name="M" select="1"/>
<xsl:param name="N" select="20"/>

<xsl:template match="/">
  <xsl:apply-templates select="record[position() &gt;= $M and position &lt;=
$N]"/>
</xsl:template>

When generating the HTML "back" and "next" buttons, assuming you're doing it
client-side, you need to generate a URL something like

<a href="javascript:moveto({$M - 20}, {$M - 1})">Back</a>
<a href="javascript:moveto({$N + 1}, {$N + 20})">Next</a>

And the javascript function "moveto" needs to invoke a new transformation on
the original XML that supplies the two arguments as parameters to the
transformation.

Of course you can refine this to avoid displaying the buttons when you are
positioned at the end, etc.

Mike Kay

> 	The solution suggested here seems to be solution to my problem
> "Display multiple pages": I have a XML document that could 
> have over 1,000
> database records, and I would like to split them up to 
> multiple pages for
> display purposes, with Prev and Next button to advance 
> between the pages.
> 




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


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.