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.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type | Description |
$parameter1 |
item()* |
the first sequence to compare |
$parameter2 |
item()* |
the second sequence to compare |
$collation |
xs:string |
the collation to use for comparing strings |
return value |
xs:boolean |
Examples<xsl:variable name="prod1" as="item()*"> | | <product dept='MEN' id='P123'>
<number>784</number>
</product> |
| </xsl:variable> | <xsl:variable name="prod2" as="item()*"> | | <product id='P123' dept='MEN'><!--comment-->
<number>784</number>
</product> |
| </xsl:variable> |
XPath Example | 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 AlsoHistory |
Recommended Reading:
|