Subject: Re: [xsl] Ranking Random Nodes from Top to Bottom From: "J. Zhang" <j.zhang@xxxxxx> Date: Fri, 17 Aug 2007 15:32:28 +0200 |
J. Zhang wrote:I have unstructured text now, it would be great if I could order that, but Michael has said that I do not have enough information to do the ordering, which I just realized. So I need to slightly modify my stylesheet again to include that information in my output files. A problem is that a DTD is missing, so there is nothing to fall back on.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.
Thanks, jz
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?
string-length(string-before(., '['))
It is better to log the string length from root to the beginning of each particular node,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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Ranking Random Nodes from, Abel Braaksma | Thread | Re: [xsl] Ranking Random Nodes from, Abel Braaksma |
Re: [xsl] Ranking Random Nodes from, Abel Braaksma | Date | RE: [xsl] Ranking Random Nodes from, Michael Kay |
Month |