Defines a named set of attributes.
<xsl:attribute-set name = QName use-attribute-sets = QNames </xsl:attribute-set>
Required. The Qualified Names of the attribute set. The value of the
nameattribute is a qualified name.
A white space-separated list of attribute sets, specified as a Qualified Names. Specifying this attribute declares each attribute in each listed attribute set.
Number of occurrences
The content of the
<xsl:attribute-set> element consists of zero or more
<xsl:attribute> elements that specify the attributes in the set. To use attribute sets, specify a
use-attribute-sets attribute on
An error occurs if using
<xsl:attribute-set> elements causes an attribute set to directly or indirectly use itself.
use-attribute-sets attribute can be an efficient way to declare multiple attributes on an element. To accomplish the same results using
<xsl:attribute>, you would have to use an
<xsl:attribute>element for each attribute in each named attribute set. You would add these
<xsl:attribute> elements as content of the
Attribute sets can also be used by specifying an
xsl:use-attribute-sets attribute on a literal result element. For a literal result element, attributes will be added in the following order:
Attributes from attribute sets named in an
xsl:use-attribute-setsattribute, in the order listed in that attribute.
Attributes specified on the literal result element.
Any attributes specified by
<xsl:attribute>elements will be added.
Because adding an attribute to an element replaces any existing attribute of that element with the same name, attributes specified in attribute sets can be overridden by attributes specified on the literal result element itself.
The template within each
<xsl:attribute> element in an
<xsl:attribute-set> element is instantiated each time the attribute set is used. It is instantiated using the same current node and current node list that is used for instantiating the element that bears the
xsl:use-attribute-sets attribute. However, it is the position of the
<xsl:attribute> element in the style sheet — rather than the position of the element bearing the
xsl:use-attribute-sets attribute — that determines which variable bindings are visible. Therefore, only variables and parameters declared by top-level
<xsl:param> elements are visible.
Multiple definitions of an attribute set with the same expanded-name are merged. An attribute from a definition that has higher import precedence takes precedence over an attribute from a definition that has lower import precedence.
An error occurs if there are two attribute sets that have the same expanded-name and equal import precedence, and that both contain the same attribute, unless there is a definition of the attribute set with higher import precedence that also contains the attribute.
The following topic provides an example of the