XSLT <xsl:attribute> Element
Definition and Usage
The <xsl:attribute> element is used to add attributes to elements.
Note: The <xsl:attribute> element replaces any existing attributes with the same name.
Syntax
Attributes
| Attribute | Value | Description |
|---|---|---|
| name | attributename | Required. Specifies the name of the attribute. |
| namespace | URI | Optional. Defines the namespace URI for the attribute. |
Example 1
Adding a source attribute to the picture element:
Example 2
Adding a source attribute to the picture element and assigning it a value from "images/name":
Example 3
Creating a set of attributes that can be applied to any output element: