Hi, I'm trying to use templates in order to write more modulare code.
My question is: is possible to have a template returning an xml element, or at least more than just one variable?
I tried to use the copy-of statement but it doesn't seem to work properly.
As an example I paste here the code of my template;
template print-mcast-route($ip-address) {
var $rpc = <get-multicast-route-information>{<extensive>;}
var $results = jcs:invoke($rpc);
for-each($results/route-family/multicast-route[multicast-group-address == $ip-address])
{
var $multicast-source-address = multicast-source-address;
var $multicast-source-prefix-length = multicast-source-prefix-length;
var $multicast-source = $multicast-source-address _ "/" _ $multicast-source-prefix-length;
var $multicast-route-state = multicast-route-state;
}
copy-of $multicast-source;
copy-of $multicast-route-state;
}
If I call this template, it returns only the $multicast-route-state, but not the $multicast-source variable.
I dont' think I am using the correct syntax, and I already tried several workarounds without any success....The documentation about templates did not help me so much (I studied the day-One books as well as the "configuration and diagnostic automation guide").
Thanks in advance for your help,
Mattia