Is it possible to run just a single query to replace multiple queries?
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/@exclude
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/../problem[1]
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/../reference[1]
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/../impact[1]
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/../background[1]
//host_info[hostname="localhost" and vulnerability_id="remote_execution"][1]/../resolution[1]
For some reason this doesn't work in PHP's xpath() function.
//host_info[hostname="localhost" and vulnerability_id="remote_execution"]/(*, ../background, ../impact, ../problem)
I feel there has to be a better way here. Please note it's possible to have multiple <host_info> nodes which is why I'm targeting the hostname and vulnerability_id. But there are only one <background>, <resolution> nodes contained in the parent <vulnerability_id> node.
<report>
<vulnerability>
<host_info>
<hostname></hostname>
<vulnerability_id></vulnerability_id>
</host_info>
<host_info>
<hostname></hostname>
<vulnerability_id></vulnerability_id>
</host_info>
<background></background>
<resolution></resolution>
</vulnerability>
<vulnerability>
<host_info></host_info>
<host_info></host_info>
<host_info></host_info>
<host_info></host_info>
<background></background>
<resolution></resolution>
</vulnerability>
</report>