}
if (xresult instanceof XNull) {
return null;
}
if (xresult instanceof XString) {
return new SimpleScalar(xresult.toString());
}
if (xresult instanceof XNumber) {
return new SimpleNumber(new Double(((XNumber) xresult).num()));
}
throw new TemplateModelException("Cannot deal with type: " + xresult.getClass().getName());