O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

name

Defines the name of this attribute set.

Optional Attribute

use-attribute-sets

Lists 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 set A embeds attribute set B, and attribute set B embeds attribute set C, and attribute set C embeds attribute set A, 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"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required