This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug Sorting Zeros



Rechell Schwartz writes:
>I just tried sorting a list of numbers using Xalan for Java and found
>that the value of zero did not sort where I expected it to. In fact it
>appears that it was treated as though it was not a number.

Our sort01 and sort09 tests are designed to test for this behavior. I'll
review what's in there. I'll modify sort13 to try to catch this as well.

>Also, is there a way to cause non-numerical values to appear after
>numerical values, instead of before?

No. Erratum E20 requires before for ascending, after for descending.
By combining the meaning of multiple sentences in Chapter 10 of the
base document, one can deduce that all the NaN-equivalent values,
regardless of what string they are, must occur in document order within
the cluster of NaN-equivalents.

>Similarly, when sorting strings is there a way to cause numerical values
>to appear after all string values instead of before?

If your data type is "text", numbers get no special recognition. It
appears that you want to do a two-level sort, where the upper level is
a boolean on numeric vs. non-numeric (likely inefficient to calculate)
and the lower sort is numeric. If you also need the text strings to be
alphabetically ordered at the same time that the numbers are sorted,
you'll have to look at it as a two-pass situation, possibly using
template modes.
.................David Marston


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]