Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SORT XML

Posted on 2004-04-08
6
Medium Priority
?
292 Views
Last Modified: 2013-11-19
Hi Experts,

I have JSP getting XML based on criteria and then parsing it via XSLT.
Is there way to presort by some attribute this XML before parsing it ?

If yes how would it be done and give me some simple example.


Thank you.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10783919
Have you looked at the XSLT sort element xsl:sort?

http://www.devguru.com/Technologies/xslt/quickref/xslt_element_sort.html
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10784209
I need to sort it permanently and keep this way before parsing it because I use paging.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10784222
It means to get XML then sort it and save sorted in some directory and only then use it.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 7

Expert Comment

by:searlas
ID: 10784425
Is this your situation?

1) Batch process XML files to sort, and save sorted files
...time passes...
2) JSP processes pre-sorted XML with XSLT to output (what?  HTML?)


If so, why not:
1) Batch process XML using XSLT to sort and output sorted XML to file.
2) as before...
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10784486
The problem is that I use paging and sort does not help for the whole result set. So I need to get this XML sorted and kept
in some temp dir and then use it for display using another XSLT.

May be there is a better way ?

Thank you.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 2000 total points
ID: 10785469
If I get it right then you are converting your resultset to XML....
If that the case why don't you query the database with a Order By clause??? It will return the data in sorted order and hence your XML will automatically a sorted one...
there will be no need to put it in a temp directory as well....
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to dynamically set the form action using jQuery.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question