Name

<xsl:attribute set>

Synopsis

This allows the naming of a collection of attributes that can be applied to elements.

The following example creates an attribute set for images and applies them with a template:

<xsl:attribute-set name="image">
 <xsl:attribute name="border">0</xsl:attribute>
   <xsl:attribute name="width">120</xsl:attribute>
   <xsl:attribute name="height">60</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="image">
   <img src="{@url}" xsl:use-attribute-sets="image"/>
</xsl:template>

The use-attribute-sets option allows you to include a list of other attribute sets in the one being defined.

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

Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.