Hi all,
I'm running a query in a policy and need to check if anything was found. At the moment I check:
XPath(count($resultNodeset) > 0
Is there a better way? Does a DirXML nodeset have something like JS .length that I can check?
Cybersecurity
DevOps Cloud
IT Operations Cloud
Hi all,
I'm running a query in a policy and need to check if anything was found. At the moment I check:
XPath(count($resultNodeset) > 0
Is there a better way? Does a DirXML nodeset have something like JS .length that I can check?
In a query-response you can simply look for the existence of an <instance>
-element with a src-dn
attribute.
As for nodesets in general, it really depends on what you mean by "empty". A Node
with nothing in it (i.e. its value is the empty string) is still included by count()
. If you count that as being empty you'd have to filter out those nodes first: count($nodeset[string-length(.) != 0])
, otherwise count()
should be sufficient.