[xsl] deep-equal behaves differently when node is stored in a variable

Subject: [xsl] deep-equal behaves differently when node is stored in a variable
From: "Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Apr 2025 21:10:37 -0000
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>

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?

Thanks in advance for your help!

Wolfhart

Current Thread