Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

attribute

Syntax

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":

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.

Release Information

Statement introduced in SLAX version 1.1.