xsl-list
[Top] [All Lists]

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

2007-08-17 06:19:35
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>

This is an interesting hint! Michael, do you mean that this collation order automatically sorts the following "correctly" (defined as: treat numeric parts as numeric)?

root[1]/node[12]
root[1]/node[6]
root[1]/node[11]
root[1]/node[0045]

into:
root[1]/node[6]
root[1]/node[11]
root[1]/node[12]
root[1]/node[0045]

Or would it still be something like:
root[1]/node[0045]
root[1]/node[11]
root[1]/node[12]
root[1]/node[6]


Cheers,
-- Abel Braaksma


--~------------------------------------------------------------------
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>
--~--