The jcs:invoke() function invokes an RPC. It can be called with one argument, either a string containing a JUNOS XML or JUNOScript RPC method name or a tree containing an RPC. The result is the contents of the <rpc-reply> element, not the <rpc-reply> tag element itself.
In the following example, there is a test to see if the interface argument is included on the command line when the script is executed. If it is, the operational mode output of the show interfaces terse command is narrowed to include information about that interface only.
<xsl:param name="interface"/>
<xsl:variable name="rpc">
<get-interface-information>
<terse/>
<xsl:if test="$interface">
<interface-name>
<xsl:value-of select="$interface"/>
</interface-name>
</xsl:if>
</get-interface-information>
</xsl:variable>
<xsl:variable name="out" select="jcs:invoke($rpc)"/>
In this example, the jcs:invoke() function calls an RPC without modifying the output:
- <xsl:variable name="sw" select="jcs:invoke('get-software-information')"/>