Given a xml file with large records. I need change the xml file into html format. It's easy to display it in one page but difficult for me to paginate it. Is there any stuff about it?
Please help!
-
About XML pagination ... (3 messages)
- Posted by: tony lu
- Posted on: January 11 2004 02:18 EST
Threaded Messages (3)
- About XML pagination ... by Paul Strack on January 11 2004 11:19 EST
- About XML pagination ... by tony lu on January 11 2004 21:20 EST
- About XML pagination ... by steve souza on January 11 2004 23:03 EST
-
About XML pagination ...[ Go to top ]
- Posted by: Paul Strack
- Posted on: January 11 2004 11:19 EST
- in response to tony lu
I presume you are using XSLT to convert your XML to HTML. The thing that you need to do is pass a $start parameter to the XSLT to determine the records you need to display. Once you do that, thing are easy; you simply add an additional predicate to your XPath:
[(position() >= $start) and (position() < $start + 25)]
The above assumes you want to show 25 records at a time. Unfortunately, how to pass the $start parameter is a bit tricky.
1) If you are relying on the browser's XSLT transformer, you are in trouble; so far as I know, there is no generic way to pass variables to a browser's transformer.
2) If you are using server-side transformation with a JAXP Transformer, things are easier. You can use the Transformer.setParameter() method:
transformer.setParameter("start", "101");
In your XSLT, you will need a parameter declaration in the main stylesheet, with a default value (e.g. 1).
<xsl:param name="start" select="'1'" /> -
About XML pagination ...[ Go to top ]
- Posted by: tony lu
- Posted on: January 11 2004 21:20 EST
- in response to Paul Strack
Thank you for your kindness Paul.
I am using JAXP Transformer and want to display it on my jsp page.
It will do greate to me.
Thank you very much. -
About XML pagination ...[ Go to top ]
- Posted by: steve souza
- Posted on: January 11 2004 23:03 EST
- in response to tony lu
Here is a nice link on pagination at Java Ranch.
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=7&t=011247
Steve - http://www.fdsapi.com - An easy to use open source API to generate dynamic HTML and XML