* Return the type of the supplied value: "sequence", "string", "number", "boolean",
* "external". (EXSLT spec not yet modified to cater for XPath 2.0 data model)
*/
public static String objectType(XPathContext context, Value value) {
final TypeHierarchy th = context.getConfiguration().getTypeHierarchy();
ItemType type = value.getItemType(th);
if (th.isSubType(type, AnyNodeTest.getInstance())) {
return "node-set";
} else if (th.isSubType(type, BuiltInAtomicType.STRING)) {
return "string";
} else if (th.isSubType(type, BuiltInAtomicType.NUMERIC)) {
return "number";
} else if (th.isSubType(type, BuiltInAtomicType.BOOLEAN)) {
return "boolean";
} else {
return type.toString(context.getNamePool());
}
}