On 15/04/2025 23:11, Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx
wrote:
Dear list,
I would like to ask for your help with the following puzzling behavior
that I have encountered. The situation is that I am testing whether
the context node, which is a <person> element with child elements
(first?, middle?, last), is deep-equal to one of a set of other nodes.
I found the following solution:
some $p in //person satisfies deep-equal($p, .)
However, when I store the context node in a variable, like so:
<xsl:variable name="person">
\xA0\xA0 <xsl:copy-of select="."/>
</xsl:variable>
That creates a document node containing a copy of the context node, so
you either need
B <xsl:variable name="person" select="."/>
or, if you, for reasons I don't see, want to use the inner selection, use
B <xsl:variable name="person" as="node()">
B B B B <xsl:sequence select="."/>
B </xsl:variable>
and then make the comparison with the variable, like so:
some $p in //person satisfies deep-equal($p, $person)
then the test comes out false. Why is that? Why does it make a
difference whether I store the context node in a variable or call it
directly?
A document node is not deep-equal to an element node.
|