Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

processing-instruction

 

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

Add an XML processing instruction to the result tree. A processing instruction is a mechanism to convey application-specific information inside an XML document. The application can detect processing instructions and change their behavior accordingly. The instruction name is mandatory and becomes the target of the processing instruction. It can be a hard-coded string, a variable, or an XPath expression. The optional body generates the processing instruction’s content, which consists of one or more name-value pairs. The generated instruction is enclosed within the tags <? and ?>.

Junos OS SLAX scripts generally do not require the processing-instruction statement, because the result tree is processed directly by Junos OS. However, you might add a processing instruction to an XML document that is written to disk through the <xsl:document> instruction element or one of its related extension elements.

Attributes

instruction-nameIdentifier for the processing instruction, which can be a string, a variable, or an XPath expression.
instruction-valueInstruction content, which consists of name-value pairs.

SLAX Example

The following code creates the processing instruction xml-stylesheet. The instruction content contains two name-value pairs: type and href.

The corresponding output in the result tree is:

The following example writes an XML document to the file /var/tmp/output.xml using the <xsl:document> instruction element. The script adds a processing instruction named instruction to the document.

The script generates the file /var/tmp/output.xml, which contains the processing instruction enclosed within <? and ?> tags.