Skip to content

XSLT <xsl:attribute-set>

How to define reusable attribute sets in XSLT using <xsl:attribute-set> for consistent styling across output elements.

XSLT <xsl:attribute-set>

The <xsl:attribute-set> element creates a named set of attributes. The attribute-set can be applied as whole to the output document.

Syntax

<xsl:attribute-set name="name" use-attribute-sets="name-list">

	<!-- Content:xsl:attribute* -->

</xsl:attribute-set>

Attributes

Attribute Value Required/Optional Description
name name Required Specifies the name of the attribute-set
use-attribute-sets name-list Optional A white space separated list of other attribute-sets to use in the attribute-set

Example

Create an attribute-set that can be applied to any output element:

example.xslxml
<xsl:attribute-set name="font">  
	<xsl:attribute name="fname">Arial</xsl:attribute>  
	<xsl:attribute name="size">14px</xsl:attribute>  
	<xsl:attribute name="color">red</xsl:attribute>  
</xsl:attribute-set>
Navigation