Re: Paging using XSLT

Subject: Re: Paging using XSLT
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Fri, 3 Nov 2000 13:21:13 -0400 (EST)
| >in their stylesheet to "filter" the data to emit
| >only rows N through M of those 25000 onto the browser.
| >(Where M-N is usually in the 10-15 range).
| </Steve>
| How did they do this? I am trying to do the same, but I do not have
| so many records. I am already using a bunch of filters to reduce the
| amount of data.

This topic is getting a little off the XSLT track for
this list, but as a final posting, I'll note that
the way with Oracle to achieve this is to use
the "TOP-N" query feature in Oracle8i.

If you are ordering your data by a value that
makes each row distinct (e.g. the primary key
or any other unique key), then to retrieve
the "next 10" rows after a certain key that
was "last" on the current page, you can do:

SELECT userid, firstname, lastname, phone
  FROM ( SELECT userid, firstname, lastname, phone
           FROM all_emps
          WHERE lastname like '%JONES%'  /* This was the orig query critera */
           AND  userid > 'abjones'       /* Return matches beyond 'abjones' */
        ORDER BY userid                  /* Order the inner query by userid */
  WHERE ROWNUM <= 10  /* Get the "top-10", i.e. first 10, rows */

I cover this topic of stateless paging in my book on pages 643-655.

| The "big" advantage I get by paging and sorting at the browser(/client)
| end is that I do not have to hit the web_server/db_server again for the
| same (sorted/paged) data.If I have to save some db hits, I may have to
| cache the data using sessions.

The tradeoff depends on the probability that the users
will visit all of the rows. If the user is likely to 
visit all the rows, then one big hit is probably better
and browser-side XSLT can be helpful.

If the user is likely to conclude after paging through
a couple of pages that they *should* have refined their
query criteria a little better (imagine a
search where you typically don't go beyond the first
couple of pages of "most relevant" hits), then downloading
all the hits might be a bad idea. Depends on the app.

Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly

 XSL-List info and archive:

Current Thread