if ((arg0 instanceof WGContent) && (arg1 instanceof WGContent)) {
TMLContext context0 = tag.getTMLContextForDocument((WGContent) arg0);
ExpressionEngine engine0 = this.getEngine(context0.content());
ExpressionResult result0 = engine0.evaluateExpression(this.expression, context0, ExpressionEngine.TYPE_EXPRESSION, null);
if (result0.isError()) {
this.tag.addWarning("Error in sort expression evaluation: " + result0.getException().getMessage() + " (Expression: [" + result0.getException().getExpression() + "])");
return -1;
}
TMLContext context1 = tag.getTMLContextForDocument((WGContent) arg1);
ExpressionEngine engine1 = this.getEngine(context1.content());
ExpressionResult result1 = engine1.evaluateExpression(this.expression, context1, ExpressionEngine.TYPE_EXPRESSION, null);
if (result1.isError()) {
this.tag.addWarning("Error in sort expression evaluation: " + result1.getException().getMessage() + " (Expression: [" + result1.getException().getExpression() + "])");
return 1;
}
return super.compare(result0.getResult(), result1.getResult());
}
else {
return 0;