private bool CanFoldXsltConvertNonLossy(QilNode ndLiteral, XmlQueryType typTarget) {
QilNode ndDest;
// Fold conversion to target type; if conversion cannot be folded, a XsltConvert node is returned
ndDest = FoldXsltConvert(ndLiteral, typTarget);
if (ndDest.NodeType == QilNodeType.XsltConvert)
return false;
// Convert back to source type; if conversion cannot be folded, a XsltConvert node is returned
ndDest = FoldXsltConvert(ndDest, ndLiteral.XmlType);
if (ndDest.NodeType == QilNodeType.XsltConvert)
return false;
// If original value is the same as the round-tripped value, then conversion is non-lossy
return ExtractLiteralValue(ndLiteral).Equals(ExtractLiteralValue(ndDest));
}