Sort Before Paging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chan

    Sort Before Paging

    I have about 1,000 records in my XML to be shown. It's too much to
    display all of them at once. So, paging is a good implementation.

    I'm doing all this at client side, that is,
    - xml dataisland
    - client-side xslt
    - client-side script (Java or VB)
    for the purpose of performance and less load at web server.

    To achieve paging, Michael Kay has given an example
    (http://www.biglist.com/lists/xsl-lis.../msg00142.html)
    using

    <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;=
    $N]"/>
    </xsl:template>

    Now, supposed users want sorting and paging combined with sorting taking place
    first. Since <xsl:sort> is the child element of <xsl:apply-templates>, it
    becomes,

    ....
    <xsl:template match="/">
    <xsl:apply-templates select="record[position() &gt;= $M and position
    &lt;= $N]">
    <xsl:sort select="somethi ng" order="ascendin g"/>
    </xsl:apply-templates>
    </xsl:template>

    But doing so will only sort nodes within the page, not overall.

    Any clue?

    Thanks.
Working...