Saxon has a built-in collation option which will handle such sort keys
directly:
<xsl:sort select="..."
collation="http://saxon.sf.net/collation?alphanumeric=yes"
It's product-dependent, of course, but it might save you some work.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Yves Forkl [mailto:Y(_dot_)Forkl(_at_)srz(_dot_)de]
Sent: 25 July 2006 10:43
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Creating a padded sort key: easier from elt
sequence or string?
Hi,
I'm lucky to be able to define some XML structure largely
according to the needs of (XSLT) processing.
I have strings of variable length consisting of numbers and
letters separated by dots, like "3.11.A.9" or "3.2.B.7".
Each of these strings shall take the role of a value for a
sort key, but only after padding each number with sufficient
zeros in order to sort "3.11.A.9" after and not before
"3.2.B.7" (then "3.02.B.7"). The letters are always single
letters, and the numbers have no more than 3 digits.
My question is as follows: which XML representation is more
convenient when trying to fulfil this task in XSLT 1.1?
1) a PCDATA element containing a string like the ones above
2) an element containing a sequence of PCDATA elements, one
for each of the numbers and letters (the dot in between may
be added during processing)
And what's the best way of going about implementing the
creation of the padded sort keys in XSLT from the more
favorable representation? Would the solution differ much in XSLT 2.0?
Any hints are very much appreciated.
Yves
--~------------------------------------------------------------------
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>
--~--