toXPathString function
XPath string().
Numbers print as integers when within 1e-12 of (int) d; because
Java's cast saturates at 2^31, larger whole numbers print in Java
notation (string(10000000000) is 1.0E10).
Implementation
String toXPathString(Object value) {
final o = unpack(value);
return switch (o) {
bool() => o ? 'true' : 'false',
double() => _numberToString(o),
String() => o,
DateTime() => date_utils.formatDate(o, DateFormatStyle.iso8601),
ExprDataType() => o.toString(),
_ => throw XPathTypeMismatchException('converting to string'),
};
}