[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Ranking Random Nodes from Top to Bottom

Subject: Re: Ranking Random Nodes from Top to Bottom
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 17 Aug 2007 15:24:31 +0200
Re:  Ranking Random Nodes from Top to Bottom
J. Zhang wrote:
Hi Michael,

There are about 20 different elements in my files. I have not counted yet the precise figure.

now you talk of elements? I thought it was an unstructured text file with strings on each line that needed to be sorted.



You are right, I would have trouble sorting /root[1]/a[3] and /root[1]/b[5].

Using my or Michael's suggestions, 'a' will turn up before 'b'. That is alphabetical, is that not what you want?



It is better to log the string length from root to the beginning of each particular node,
string-length(string-before(., '['))
and then use that number to rank the elements from Top to Bottom.

<xsl:sort select="string-length(string-before(., '['))" />


In fact, that is what I want to do. What be your recommendation to do that?

See above. But I have no clue why that could be useful at all. It would order


root/cba
root/z
root/longnodename
root/_short

into:
root/z
root/cba
root/_short
root/longnodename

But to make it clear to everybody on this list, your best bet is to explain what you are after. Show what you currently have. Give small examples of representative input data and show what output you would expect and why. We're guessing too much about what you are after, help us help you.

Cheers,
-- Abel Braaksma

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.