|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Paging using XSLT
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() >= $M and position <=
$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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








