So I have XML documents A and B.
For this purpose, the markup (which is known to be different) is not relevant; the thing I need to do is prove that all of the text in the string value of A is present in B in the same order in which it exists in A. Document B can have additional text and still be correct, so it is not sufficient to check if string(A) = string(B). (Ideally, B's extra text can be extracted and then compared against the sources of extra text in the transformation between A and B so as to confirm that it's at least all plausible new text.)
At least on the string level even XPath 1 comparisons with
substring-before/after should suffice e.g.
if (string(A) = string(B))
then "complete match"
else
let $prefix := substring-before(string(B), string(A)),
$suffix := substring-after(string(B), string(A))
return if ($suffix != '' or $prefix != '')
then "partial match"
else "no match"
I don't know what the "plausible new text" requirement is about
or how to express it.