xsl-list
[Top] [All Lists]

Re: [xsl] Ranking Random Nodes from Top to Bottom

2007-08-17 06:06:39
Hi Michael,

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

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

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. In fact, that is what I want to do. What be your recommendation to do that?

Ty,
  jz

Michael Kay wrote:
Are "root" and "node" the only element names that appear?

If you had /root[1]/a[3] and /root[1]/b[5], how would you want them sorted?

I would expect that Saxon's alphanumeric collation would do quite a good job
of this:

<xsl:perform-sort select="tokenize(unparsed-text('input.txt'), '\n')">
  <xsl:sort select="."
collation="http://saxon.sf.net/collation?alphanumeric=yes"/>
</xsl:perform-sort>

Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: J. Zhang [mailto:j(_dot_)zhang(_at_)uva(_dot_)nl] Sent: 17 August 2007 11:46
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Ranking Random Nodes from Top to Bottom

Hi all,

I got a long list of absolute xpath paths in a flat file, like

/root[1]/node[2]/node[12]/node[1]
/root[1]/node[1]
/root[1]/node[2]/node[12]/node[1]
/root[1]/node[4]/node[12]
/root[1]

Is there an existing function in Saxon or ready-made code to rank the list of nodes from top to bottom?

Thanks by advance!
   jz

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--