Sorting and Paging in one pass with XSLT 2
I am trying to use some of the new XSLT 2 functionality to improve my sorting and paging performance.
Ideally I would be able to sort and splice a large document tree in one pass.
So sort the tree and put x # of records in each result document.
Here's a pseudo of what I'm trying to do:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="perPage" select="number('10')"/>
<xsl:variable name="page" select="ceiling(position()/$perPage)"/>
Obviously this won't work as it would try create a new result-document on each pass. Whereas I need the first $perPage rows to go into the same result-document.
I was hoping to find a way to use the grouping functionality in xslt 2. Possibly grouping records by their page and then iterate through creating a new result-document for each group of records. I couldn't find a way to do this with one pass through the document, which is what I'm trying to stick with since I can potentially have very large incoming xml.
Any ideas or suggestions for implementing an efficient method of sorting and then paging the results?
Best Regards, Kyle
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