Subject: RE: [xsl] Creating a padded sort key: easier from elt sequence or string? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 25 Jul 2006 11:55:14 +0100 |
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.Forkl@xxxxxx] > Sent: 25 July 2006 10:43 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Creating a padded sort ke, David Carlisle | Thread | [xsl] Problem passing parameter ASP, Garry Searle |
[xsl] listing elements & sub-elemen, Karl | Date | [xsl] Problem passing parameter ASP, Garry Searle |
Month |