Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


output() Function (Python, SLAX, and XSLT)


Python Syntax

SLAX Syntax

XSLT Syntax


Display one or more lines of output text, either on the CLI (when used in op scripts), or to the output file (when used in event scripts). The function can be called with either a single string argument or with multiple string arguments. Multiple arguments are concatenated into a single string. A newline terminates the output text.

The output() function is not supported in commit scripts. SLAX and XSLT commit scripts use the <xnm:warning> and <xnm:error> result tree elements to display text on the CLI, and Python commit scripts use the emit_warning() and emit_error() functions.

The output() function displays the text immediately rather than waiting until the conclusion of the script, which differs from the SLAX and XSLT <output> element. This makes it suitable for scripts where user interaction is required or when status messages should be displayed during script processing. In SLAX and XSLT scripts, jcs:output() returns an empty node set, which can be ignored. Therefore, the jcs:output() function is normally called with the expr statement, rather than assigning its result to a variable.

The following escape characters are supported in the output text:

  • \\ –Backslash (as of Junos OS Release 10.2)

  • \r –Carriage Return

  • \" –Double quote (as of Junos OS Release 10.1R2)

  • \n –Newline

  • \' – Single quote

  • \t –Tab

Starting in Junos OS Release 10.2, the maximum length for output text is 10 KB, and longer strings are truncated to the supported length.

The prefix associated with the namespace URI should be defined in the prefix-to-namespace mapping in the style sheet.



Text that is output immediately to the CLI session.

Usage Examples

SLAX syntax:

XSLT syntax:

Python syntax:

Release Information

Function introduced in Junos OS Release 7.6.

Support for the slax namespace added in Junos OS Release 12.2.

Support for Python added in Junos OS Release 16.1R1 on QFX Series switches and ACX Series, MX Series, PTX Series, and T Series routers.

Support for Python added in Junos OS Release 17.1R1 on ACX500, ACX1000, ACX1100, ACX2000, ACX2100, ACX2200, and ACX4000 routers, and EX Series switches.

Support for Python added in Junos OS Release 17.3R1 on SRX1500, SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices and vSRX instances.

Support for Python added in Junos OS Release 18.3R1 on ACX5048 and ACX5096 routers.