Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

output-method

Syntax

Description

Define the style used for result tree output. The output-method statement must be defined as a top-level statement in the script. Output formats include HTML, text, or XML. The default is XML, unless the first child element of the root node is <html> and there are no preceding text nodes, in which case the default output format is HTML.

Attributes

output-format

Specify the format of the output. Acceptable values are “html”, “text”, “xml”, or a qualified name. The default is XML, unless the first child element of the root node is <html> and there are no preceding text nodes, in which case the default output format is HTML. Specifying a format of XML adds the XML declaration (<?xml ?>) to the result tree file.

cdata-section-elements name-list

Specify a space-delimited list of the names of output elements whose text contents should be output to the result tree using CDATA sections. A CDATA section starts with "<![CDATA[" and ends with "]]>", and the contents of the section are interpreted by an XML parser as character data only, rather than markup.

doctype-public string

Add the DOCTYPE declaration to the result tree, and specify the value of the PUBLIC attribute, which tells the parser where to locate the Document Type Definition (DTD) file.

doctype-system string

Add the DOCTYPE declaration to the result tree, and specify the value of the SYSTEM attribute, which tells the parser where to locate the DTD file on the system.

encoding string

Explicitly add the pseudo-attribute encoding to the XML declaration in the output, and specify the character encoding used to encode the document, for example UTF-8, UTF-16, or ISO-8859-1.

indent "yes" | "no"

Specify whether to indent the result tree output according to the hierarchical structure. Acceptable values are “yes” and “no”.

  • Default: No indentation

media-type string

Define the MIME content type of the output.

  • Default: text/xml

omit-xml-declaration "yes" | "no"

Specify whether to include or omit the XML declaration (<?xml ?> ) in the output.

  • Default: no

standalone "yes" | "no"

Explicitly add the pseudo-attribute standalone with the given string value to the XML declaration (<?xml ?> ) in the output . Acceptable values are “yes” and “no”. The standalone attribute is only relevant if the document uses a DTD. If the standalone option is not included in the output-method statement, there is no explicit declaration in the result tree, which is identical to standalone="no".

version string

For HTML and XML formats, set the W3C version for the output format. The pseudo-attribute version is included in the XML declaration (<?xml ?> ) with the given version number.

SLAX Example

The following example uses the output method XML, which creates an XML declaration in the result tree output and adds the pseudo-attributes version, encoding, and standalone to the declaration. The DOCTYPE declaration has the root element <html> and provides values for both the PUBLIC and the SYSTEM attributes.

The script produces the following output:

The following example is similar to the previous example except that the script does not specify an output format. Since the first child element of the root node is <html>, the output format defaults to HTML.

The default output format is HTML. The XML declaration is omitted from the output.

Release Information

Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.