deep-equal

Whether two nodes have the same content and attributes

Description

The fn:deep-equal function returns true if the $parameter1 and $parameter2 sequences contain the same values, in the same order.

Atomic values are compared based on their typed values, using the eq operator. If two atomic values cannot be compared (e.g. because one is a number, and the other is a string), the function returns false rather than raise an error.

Informally, two nodes are deep-equal if they have all the same attributes and have children (in the same order) who are themselves deep-equal.

Parameters

Description

parameter1:item()

the first sequence to compare

parameter2:item()

the second sequence to compare

collation:string()

the collation to use for comparing strings

Examples

XPath

Results

deep-equal( 1, 1 )

true

deep-equal( (1, 1), (1, 1) )

true

deep-equal( (1, 2), (1.0, 2.0) )

true

deep-equal( (1, 2), (2, 1) )

false

deep-equal( $prod1, $prod2 )

true

deep-equal( $prod1/number, $prod2/number )

true

See Also