| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.XPathContext; |
| 11 |
import net.sf.saxon.lib.StringCollator; |
| 12 |
import net.sf.saxon.om.Sequence; |
| 13 |
import net.sf.saxon.trans.XPathException; |
| 14 |
import net.sf.saxon.value.StringValue; |
| 15 |
|
| 16 |
import java.util.List; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public class Sort_2 extends Sort_1 { |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException { |
| 33 |
final List<ItemToBeSorted> inputList = getItemsToBeSorted(arguments[0]); |
| 34 |
return doSort(inputList, getCollation(context, arguments[1]), context); |
| 35 |
} |
| 36 |
|
| 37 |
protected StringCollator getCollation(XPathContext context, Sequence<?> collationArg) throws XPathException { |
| 38 |
StringValue secondArg = (StringValue)collationArg.head(); |
| 39 |
if (secondArg == null) { |
| 40 |
return context.getConfiguration().getCollation(getRetainedStaticContext().getDefaultCollationName()); |
| 41 |
} else { |
| 42 |
return context.getConfiguration().getCollation(secondArg.getStringValue(), getStaticBaseUriString()); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
} |