keys = new Vector();
// March backwards, collecting the sort keys.
for (int i = 0; i < nElems; i++)
{
ElemSort sort = foreach.getSortElem(i);
if (TransformerImpl.S_DEBUG)
getTraceManager().fireTraceEvent(sort);
String langString =
(null != sort.getLang())
? sort.getLang().evaluate(xctxt, sourceNodeContext, foreach) : null;
String dataTypeString = sort.getDataType().evaluate(xctxt,
sourceNodeContext, foreach);
if (dataTypeString.indexOf(":") >= 0)
System.out.println(
"TODO: Need to write the hooks for QNAME sort data type");
else if (!(dataTypeString.equalsIgnoreCase(Constants.ATTRVAL_DATATYPE_TEXT))
&&!(dataTypeString.equalsIgnoreCase(
Constants.ATTRVAL_DATATYPE_NUMBER)))
foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_DATATYPE,
dataTypeString });
boolean treatAsNumbers =
((null != dataTypeString) && dataTypeString.equals(
Constants.ATTRVAL_DATATYPE_NUMBER)) ? true : false;
String orderString = sort.getOrder().evaluate(xctxt, sourceNodeContext,
foreach);
if (!(orderString.equalsIgnoreCase(Constants.ATTRVAL_ORDER_ASCENDING))
&&!(orderString.equalsIgnoreCase(
Constants.ATTRVAL_ORDER_DESCENDING)))
foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_ORDER,
orderString });
boolean descending =
((null != orderString) && orderString.equals(
Constants.ATTRVAL_ORDER_DESCENDING)) ? true : false;
AVT caseOrder = sort.getCaseOrder();
boolean caseOrderUpper;
if (null != caseOrder)
{
String caseOrderString = caseOrder.evaluate(xctxt, sourceNodeContext,
foreach);
if (!(caseOrderString.equalsIgnoreCase(Constants.ATTRVAL_CASEORDER_UPPER))
&&!(caseOrderString.equalsIgnoreCase(
Constants.ATTRVAL_CASEORDER_LOWER)))
foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_CASEORDER,
caseOrderString });
caseOrderUpper =
((null != caseOrderString) && caseOrderString.equals(
Constants.ATTRVAL_CASEORDER_UPPER)) ? true : false;
}
else
{
caseOrderUpper = false;
}
keys.addElement(new NodeSortKey(this, sort.getSelect(), treatAsNumbers,
descending, langString, caseOrderUpper,
foreach));
if (TransformerImpl.S_DEBUG)
getTraceManager().fireTraceEndEvent(sort);
}