Name
<xsl:attribute-set>
Allows you to define a group of attributes for the output. You can then reference the entire attribute set with its name, rather than create all attributes individually.
Category
Top-level element.
Required Attribute
nameDefines the name of this attribute set.
Optional Attribute
use-attribute-setsLists one or more attribute sets that should be used by this attribute set. If you specify more than one set, separate their names with whitespace characters. You can use this attribute to embed other
<xsl:attribute-set>s in this one, but be aware that an<xsl:attribute-set>that directly or indirectly embeds itself results in an error. In other words, if attribute setAembeds attribute setB, and attribute setBembeds attribute setC, and attribute setCembeds attribute setA, the XSLT processor signals an error.
Content
One or more <xsl:attribute> elements.
Appears in
<xsl:attribute-set> is
a top-level element and can only appear as a child of <xsl:stylesheet>.
Defined in
[1.0] XSLT section 7.1.4, “Named Attribute Sets.”
[2.0] XSLT section 10.2, “Named Attribute Sets.”
Example
We’ll use a stylesheet with three <xsl:attribute-set>s. The first set
defines a style attribute with some
CSS properties, the second defines a couple of HTML <table> attributes and uses the first
set, while the third defines a traditional HTML element and a CSS
style attribute.
<?xml version="1.0"?>
<!-- attribute-set.xsl --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access