xsl-list
[Top] [All Lists]

Re: collapsing number ranges

2004-08-27 06:38:06

On Aug 27, 2004, at 5:21 AM, Jeni Tennison wrote:

If that's not what you're after, show us the XML of some more examples
and try to put the algorithm that you want into English or
pseudo-code.

It is basically. I'll see if I can figure out how to move it into a function (as the other posters did) that I can call from different places, and at some point I need to get it closer to the below (much more complex, it seems) example.

A real world algorithm from the Chicago Manual of Style, in English:

FIRST NUMBER            SECOND NUMBER           EXAMPLES
1-99                            use all digits                  3-10, 71-72, 
96-117
100 or multiples                use all digits                  100-104,
of 100                                                          1100-1113

101-109                 use changed part         only           101-8,
201-209, etc.                                                   1103-4          
                
110 through 199         use two or more digits          321-28,
210-299, etc.           as needed                               498-532,
                                                                        1087-89
                
                                But, if three digits change     1496-1504
                                in a four-digit number, 2787-2816
                                use all four


Ugh ... what a PITA!

I don't expect anyone to actually figure this out for me suffice to say!

Bruce