[j-nsp] set:difference() function in SLAX returns different results while input node-sets are the same
Martin T
m4rtntns at gmail.com
Fri Sep 21 09:48:38 EDT 2018
Hi Phil,
> Two issues: first is that it is really comparing nodes not contents
Yes, that I understand. For example, here both element nodes contain
the same text node, but set:difference() still returns a node-set
<vlan><id id="100">99</id></vlan>:
$ cat foo.slax
version 1.2;
var $v1 := {
<vlan> {
<id id="99"> "99";
}
<vlan> {
<id id="100"> "99";
}
}
var $v2 := $v1/*[1];
main <top> {
<diff> {
copy-of set:difference($v1/*, $v2);
}
}
$ slaxproc -g -E foo.slax
<?xml version="1.0"?>
<top>
<diff>
<vlan>
<id id="100">99</id>
</vlan>
</diff>
</top>
$
What I quite don't understand is why set:difference() considers $v1/*
and $v2/* to be different:
$ cat foo.slax
version 1.2;
var $v1 := {
<vlan> {
<id> "99";
}
<vlan> {
<id> "99";
}
}
var $v2 := {
<vlan> {
<id> "99";
}
<vlan> {
<id> "99";
}
}
main <top> {
<diff> {
copy-of set:difference($v1/*, $v2/*);
}
}
$ slaxproc -g -E foo.slax
<?xml version="1.0"?>
<top>
<diff>
<vlan>
<id>99</id>
</vlan>
<vlan>
<id>99</id>
</vlan>
</diff>
</top>
$
When I execute "print $v1/*" and "print $v2/*" in the debugger, then
the output is identical.
thanks,
Martin
More information about the juniper-nsp
mailing list