Compares two sequences, with more control than fn:deep-equal().
deep-equal($arg1 as item()*, $arg2 as item()*, $collation as xs:string?, $flags as xs:string) ➔ xs:boolean
The first sequence
The second sequence
Collation used for comparing strings
Flags controlling the way the comparison is performed.
Requires Saxon-PE or Saxon-EE.
Notes on the Saxon implementation
Introduced in Saxon 8.6.1, with changes (for additional flags) in Saxon 8.7, 9.4, and 9.5.
This function compares two sequences
$arg2 for deep
equality. The two sequences are supplied in the first two arguments. In the absence of
$flags, the function returns the same result as the
deep-equal() function in the standard XPath library. The
$flags argument is used to modify the way in which the comparison is
$collation argument is mandatory. Supply an empty sequence to use the
The flags argument is a string containing characters acting as flags that cause the
function to behave differently from the standard
The following flags are defined:
||Include namespace nodes in the comparison. For two elements to be deep-equal, they must have the same in-scope namespaces (that is, same prefix and same URI).|
||Include namespace prefixes in the comparison. For two elements or attributes to be equal, their names must use the same namespace prefix (or none).|
||Include comment nodes in the comparison. For two element or document nodes to be deep-equal, they must have the same comment node children.|
||Include processing-instruction nodes in the comparison. For two element or document nodes to be deep-equal, they must have the same processing-instruction node children.|
||Join adjacent text nodes (for example, nodes either side of an ignored comment).|
||Compare string values rather than typed values of simple-typed elements and attributes.|
||Compare type annotations on elements and attributes. The type annotations must match exactly.|
||Exclude whitespace text nodes from the comparison. Any whitespace text node in either tree is ignored (except when determining the typed value of an element annotated with a simple type or a complex type with simple content).|
||Exclude type variety from the comparison. By default, an element with simple type and an element with complex type are never deep-equal - even if their actual content is identical. Similarly, an element whose content model is empty is never deep-equal to one with an element-only content model, even if both actually have no content. This flag suppresses this check. It is useful when comparing a schema-validated document to an unvalidated document.|
||Explain reason for a non-match. If the result is not-equal, a
warning message explaining the reason will be sent to the