xsl-list
[Top] [All Lists]

Re: Collation for dotted decimal?

2006-02-07 09:19:10
In order to get this it would be necessary to "left pad" each member of the 
sequence with zeros.

exactly, that's what  format-number(number($i),$vPattern) does. In the
example I posted I just used a pattern of '000000' so everything got
padded to 6 digits, and if any numbers were 7 digits originally it did
the wrong thing. Dimitre just modified it to make sure that the list of
000 is sufficiently long (taking a wild over-estimate, actually, bt it
doesn't matter).

  What I understand this to do is to select the shortest
  dotted-decimal in the document, and then create a sequenceby
  replacing any non-zero digit or dot with a zero. And that's where
  I'm certain I'm lost. I can't picture the "template" it would
  produce and how applying that template would produce a left-padding
  of zeros. 

It takes the longest string in all your <x> elements and then creates a
string consisting of that many 0's by translating all the digits and
decimal points to zero. (You know that is all the content, from the
problem description.) so if the longets entry is 11.2.3.4.5 the
format-number pattern will be 0000000000 and the sort key for that entry
will be
0000000011.0000000002.0000000003.0000000004.0000000005

and the sort keys  for every other entry will have identical length and
you can do lexicographic rather than numeric sorting.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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