I work with the following slax op script:
---snip---
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
match / {
<op-script-results> {
var $ping-target = "10.1.1.1";
call pinger($ping-target);
}
}
template pinger($ping-target) {
/* ping the target */
var $ping-rpc = {
<ping> {
<host> $ping-target;
<count> "1";
}
}
var $ping := jcs:invoke($ping-rpc);
<output> $ping;
}
---snap---
When running it as "op ping.slax", I get the following output:
user@juniper> op ping2
10.1.1.1
10.1.1.1
56
1
0
100
no response
{master:0}
user@juniper>
Even when running it as "op ping2 | display xml", I'm just getting
user@juniper> op ping2 | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3R6/junos">
<output>
10.1.1.1
10.1.1.1
56
1
0
100
no response
</output>
<cli>
<banner>{master:0}</banner>
</cli>
</rpc-reply>
{master:0}
user@juniper>
How can I get the output in XML format?
Thanks,
Stefan
#result#xml#Slax#output#Tree