empty() Function (SLAX and XSLT)
Namespaces
http://xml.juniper.net/junos/commit-scripts/1.0 http://xml.libslax.org/slax
SLAX Syntax
var $result = prefix:empty(node-set | string);
XSLT Syntax
<xsl:variable name="result" select="prefix:empty(node-set | string)"/>
Description
Test for the presence of a value and return true if the node set or string argument evaluates to
an empty value.
The prefix associated with the namespace URI should be defined in the prefix-to-namespace mapping in the style sheet.
Parameters
(node-set | string) |
Argument to test for the presence of a value. |
Return Value
result |
Boolean value, which is |
Usage Examples
In the following example, if $set is empty, the script executes the enclosed code block:
if ( jcs:empty($set) ) {
/* Code to handle true value ($set is empty) */
}The following example tests whether the description node for interface fe-/0/0/0 is empty. If the description is missing,
a <message> tag is output.
if (jcs:empty(interfaces/interface[name="fe-0/0/0"]/description)) {
<message> "interface " _ name _ " is missing description";
}Release Information
Function introduced in Junos OS Release 7.6
Support for the slax namespace http://xml.libslax.org/slax added in Junos OS Release 12.2.