<xsl:attribute-set> |
<xsl:attribute-set name=”qname” use-attribute-sets=”qnames” >
</xsl:attribute-set> |
The xsl:attribute-set element defines and names a set containing zero or more xsl:attribute elements. Each of the xsl:attribute elements are applied to the output in the order that they occur inside the xsl:attribute-set element. An xsl:attribute element allows you to create an attribute node, define a value, and add it to the output. |
The xsl:attribute-set element can only be a child of the xsl:stylesheet or the xsl:transform elements. The concept is that you can create a set of attributes that can be applied more than once by simply calling the attribute set by name. This is not a self-closing element. The separate closing element is mandatory. |
name=”qname” |
The mandatory name attribute is the name of the attribute set. It must be a qname. A qname is a qualified name that is composed of an optional namespace prefix, a colon, which is only present if there is a prefix, and a mandatory XML name (for example, xsl:zipcode or zipcode). |
use-attribute-sets=”qnames” |
The optional use-attribute-sets attribute is a white-space-delimited list of one or more qnames of attribute sets. In other words, it is a collection of attribute set names. Each of the xsl:attribute elements in all of the attribute sets are applied to the output in the order in which they occur in the use-attribute-sets attribute. |
This is done by adding the use-attribute-sets attribute to the HTML tag or XSLT element using the following syntax: |
<table xsl:use-attribute-sets=”name”> |
<xsl:copy use-attribute-sets=”name”> … </xsl:copy> |
We use the eBIZ.com Staff List XML file for our example with the following header:
<?xml-stylesheet type=”text/xsl” href=”xslt_example_attributeset.xsl”?> and we name it: xslt_example_attributeset.xml |