attribute
Syntax
attribute attribute-name { attribute-value; }
Description
Create an attribute with the given name. The attribute value is defined by a block of statements, which must be placed inside a set of braces.
Attributes
attribute-name |
Name of the attribute, which can be an XPath expression or a string. Enclose string arguments in quotes. |
attribute-value |
A block of statements enclosed in curly braces that defines the attribute value. |
SLAX Example
In the following example, the <book>
element is output to the result tree with an attribute named format
, which has the value "PDF":
<book> { attribute "format" { expr "PDF"; } }
In the following example, the value of the <name>
node (rather than the literal string "name")
is used to create an XML attribute with a value of "from‑" concatenated
with the contents of the address node. Node values are selected from
the current context.
<source> { attribute name { expr "from-" _ address; } }
Release Information
Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.