SORT XML

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.
LVL 1
fpoyavoAsked:
Who is Participating?
 
KuldeepchaturvediConnect With a Mentor Commented:
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
 
searlasCommented:
Have you looked at the XSLT sort element xsl:sort?

http://www.devguru.com/Technologies/xslt/quickref/xslt_element_sort.html
0
 
fpoyavoAuthor Commented:
I need to sort it permanently and keep this way before parsing it because I use paging.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
fpoyavoAuthor Commented:
It means to get XML then sort it and save sorted in some directory and only then use it.
0
 
searlasCommented:
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
 
fpoyavoAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.