Project

Profile

Help

Revision 7f699db0

Added by Michael Kay almost 13 years ago

Fix bug 2406262 (numeric sort key with data-type="text")

View differences:

latest9.1/bj/net/sf/saxon/sort/SortKeyDefinition.java
1 1
package net.sf.saxon.sort;
2 2
import net.sf.saxon.Configuration;
3
import net.sf.saxon.om.StandardNames;
3 4
import net.sf.saxon.expr.*;
4 5
import net.sf.saxon.trans.XPathException;
5 6
import net.sf.saxon.type.TypeHierarchy;
......
364 365
            // TODO: build a URI allowing the collation to be reconstructed
365 366
        }
366 367

  
367
        atomicComparer = AtomicSortComparer.makeSortComparer(stringCollator,
368
                sortKey.getItemType(th).getAtomizedItemType().getPrimitiveType(), context);
369

  
370 368
        if (dataTypeExpression==null) {
369
            atomicComparer = AtomicSortComparer.makeSortComparer(stringCollator,
370
                sortKey.getItemType(th).getAtomizedItemType().getPrimitiveType(), context);
371 371
            if (!emptyLeast) {
372 372
                atomicComparer = new EmptyGreatestComparer(atomicComparer);
373 373
            }
374 374
        } else {
375 375
            String dataType = dataTypeExpression.evaluateAsString(context).toString();
376 376
            if (dataType.equals("text")) {
377
                atomicComparer = AtomicSortComparer.makeSortComparer(stringCollator,
378
                    StandardNames.XS_STRING, context);
377 379
                atomicComparer = new TextComparer(atomicComparer);
378 380
            } else if (dataType.equals("number")) {
379 381
                atomicComparer = NumericComparer.getInstance();

Also available in: Unified diff