saxon:deep-equal

Compares two sequences, with more control than fn:deep-equal().

deep-equal($arg1 as item()*, $arg2 as item()*, $flags as xs:string) ➔ xs:boolean

Arguments

 

$arg1

item()*

The first sequence

 

$arg2

item()*

The second sequence

 

$flags

xs:string

Flags controlling the way the comparison is performed.

Result

xs:boolean

Details

Namespace: http://saxon.sf.net/

This function compares two sequences $seq1 and $seq2 for deep equality. The two sequences are supplied in the first two arguments. In the absence of any $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 performed.

The $collation argument is mandatory. Supply an empty sequence to use the default collation.

The flags argument is a string containing characters acting as flags that cause the function to behave differently from the standard fn:deep-equal() function. The following flags are defined:

N 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).
F Include namespace prefixes in the comparison. For two elements or attributes to be equal, their names must use the same namespace prefix (or none).
C Include comment nodes in the comparison. For two element or document nodes to be deep-equal, they must have the same comment node children.
P 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.
J Join adjacent text nodes (for example, nodes either side of an ignored comment)
S Compare string values rather than typed values of simple-typed elements and attributes.
A Compare type annotations on elements and attributes. The type annotations must match exactly.
I Compare the is-ID and is-IDREF properties on elements and attributes.
w 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).
v 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 ErrorListener. (In general, a sequence of warning messages will be sent, starting with the lowest-level difference and moving up the tree).