XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + How to sum the values (2)
-> + Grouping nodes between like no... (3)
-> - Group and display the min valu... (1)
-> + Creating a XML document with n... (4)
-> + Remove duplicates - different ... (2)
-> + Remove duplicates in a list - ... (3)
-> - Sort before paging (4)
-> ->Sort before paging
-> ->Sort before paging
-> ->Sort before paging
-> + Min template (11)
-> + Recursion Help (2)
-> + Help needed with XSLT / XPATH (4)
-> + Axis (6)
-> + Carriage return / line feed (4)
-> + Adding a level with repeating ... (2)
-> + Group by function (2)
-> + xsl variable problems (simple) (10)
-> + XSLT Conditional Statements (2)
-> + XPST0003: XPath syntax error (3)
-> - myspace (1)
-> + XSLT to XML: Urgent Help Neede... (7)
-> + hyperlink in xslt (2)
-- Previous [1381-1400] [1401-1420] [1421-1440] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
giancarlo rossiSubject: Sort before paging
Author: giancarlo rossi
Date: 25 Aug 2006 10:07 AM
Originally Posted: 25 Aug 2006 10:08 AM
I need to sort a xml document before paging.

I use this kind of paging :
<xsl:param name="start" select="1"/>
<xsl:param name="range" select="5"/>
<xsl:template match="/">

<xsl:for-each select="/CommandList/CheckRouting/RouterList/Router/GroupList/Group/OutwardList/Outward[position() &gt;=$start and position() &lt; $start + $range]" >
<xsl:sort select="Price/Amount" data-type="number" order="ascending" />
'my code
</xsl:for-each>
</xsl:template>

The problem is that the whole document is not sorted by price,
so for each page the xsl display only the results order by price...
page per page.

infact the last value of page (1) is not greater then the first of the following page.

So I need to sort all the document by price ascending before paging.

How can I do it.
I hope you can help me.

Regards.


Postnext
James DurningSubject: Sort before paging
Author: James Durning
Date: 25 Aug 2006 01:50 PM
One way is to create a function that takes a parameter of the sorted list, and filters by position.

<xsl:param name="start" select="1"/>
<xsl:param name="range" select="5"/>
<xsl:template match="/">
<xsl:call-template name="positionfilter">
<xsl:with-param name="sortedlist">
<xsl:for-each select="/CommandList/CheckRouting/RouterList/Router/GroupList/Group/OutwardList/Outward[position() &gt;=$start and position() &lt; $start + $range]" >
<xsl:sort select="Price/Amount" data-type="number" order="ascending" />
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template/>
</xsl:template>


<xsl:template name="positionfilter">
<xsl:param name="sortedlist"/>
<xsl:for-each select="$sortedlist/*[(position() &gt;= $start) and (position() &lt; $start + $range)]">
'my code
</xsl:for-each>
</xsl:template>

Postnext
giancarlo rossiSubject: Sort before paging
Author: giancarlo rossi
Date: 25 Aug 2006 04:17 PM
Thanks.
I think that is the right solution, but now it goes on error...

"the stylesheet is empty or is it should be a not valid Document xml"
I translate from Italian this error.

It's possible that I must change all the path inside tha main template
"positionfilter" for example :

<xsl:variable name="router" select="$sortedlist/CommandList/CheckRouting/TotalRouters"/>

or

<xsl:value-of select="count($sortedlist/CommandList/CheckRouting/RouterList/Router/GroupList/Group/OutwardList/Outward)"/>


please advice me.












Posttop
giancarlo rossiSubject: Sort before paging
Author: giancarlo rossi
Date: 26 Aug 2006 05:02 AM
The error it given by

<xsl:call-template name="positionfilter">
<xsl:with-param name="sortedlist">

in the function one.

IF I omitted it works but of course is not able to create ant sorted list...


   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.