Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

output-method

 

Syntax

Release Information

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

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-formatSpecify 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-listSpecify 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 stringAdd 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 stringAdd 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 stringExplicitly 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”. The default is no indentation.
media-type stringDefine the MIME content type of the output. The default is "text/xml".
omit-xml-declaration "yes" | "no"Specify whether to include or omit the XML declaration (<?xml ?> ) in the output. The default is "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 stringFor 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.