1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 2 3<xsl:output encoding="utf-8"/> 4 5<xsl:attribute-set name="attset1"> 6 <xsl:attribute name="att1">foo</xsl:attribute> 7 <xsl:attribute name="att2">bar</xsl:attribute> 8</xsl:attribute-set> 9 10<xsl:attribute-set name="attset2"> 11 <xsl:attribute name="att3">baz</xsl:attribute> 12 <xsl:attribute name="att4">quux</xsl:attribute> 13</xsl:attribute-set> 14 15<xsl:template match="salesdata|year"> 16 <xsl:copy use-attribute-sets="attset1"> 17 <xsl:apply-templates/> 18 </xsl:copy> 19</xsl:template> 20 21<xsl:template match="region"> 22 <xsl:copy use-attribute-sets="attset2"> 23 <xsl:apply-templates/> 24 </xsl:copy> 25</xsl:template> 26 27<xsl:template match="name|sales"> 28 <xsl:copy use-attribute-sets="attset1 attset2"> 29 <xsl:apply-templates/> 30 </xsl:copy> 31</xsl:template> 32 33</xsl:stylesheet> 34