AtomicValue baseVal = node.getTypedValue();
if (baseVal instanceof StringValue) {
int primitiveType = baseVal.getTypeLabel().getPrimitiveType();
switch (primitiveType) {
case StandardNames.XS_STRING:
return new StringValue(getStringValueCS());
case StandardNames.XS_ANY_URI:
return new AnyURIValue(getStringValueCS());
default:
return new UntypedAtomicValue(getStringValueCS());
}