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)
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

<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;=

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

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:

Current Thread