Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Sort before paging
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
next
Subject:
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() >=$start and position() < $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.
next
Subject:
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() >=$start and position() < $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() >= $start) and (position() < $start + $range)]">
'my code
</xsl:for-each>
</xsl:template>
next
Subject:
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.
top
Subject:
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...
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.