Name
[2.0] deep-equal()
Compares two sequences of items to see whether they and all their descendants are equal.
Syntax
xs:booleandeep-equal(
item()*
,item()*
)
xs:booleandeep-equal(
item()*
,item()*
,$collation as xs:string
)
Inputs
Two sequences of items. An optional third argument
identifies a collation that should be used when comparing string
values. (The collation is not used when comparing node names, so
<strasse>
and <straße>
are never equal, even
though a German collation might find those string values to be the
same.)
Output
true
if the items are
deep-equal to each other; false
otherwise. Given the variety of
types of items in XSLT 2.0, the rules for two sequences being
deep-equal are somewhat complicated:
If both values are empty sequences,
deep-equal()
returnstrue
.If the two values are sequences of different lengths (
count($value1) != count($value2)
),deep-equal()
returnsfalse
.If the two values are nodes of different kinds (an element and an attribute, for example),
deep-equal()
returnsfalse
.If the two values are document nodes, they are equal only if
$value1/(*|text())
is deep-equal to$value2/(*|text())
.If the two values are element nodes, they must have the same name and the same number of attributes. Also, those attributes must have the same values, and children must all be deep-equal.
The remaining node types (attributes, processing instructions, comments, and text) are straightforward. For attributes and processing instructions, they must have the same name and the same ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.