XSLT <xsl:attribute-set> 元素

定義和用法
<xsl:attribute-set> 元素可創建命名的屬性集。該屬性集(attribute-set)可作為整體應用到輸出文檔。
注意:必須是 <xsl:stylesheet> 或 <xsl:transform> 的子節點。
語法
<xsl:attribute-set
name="name" use-attribute-sets="name-list">
<!-- Content:xsl:attribute* -->
</xsl:attribute-set>
name="name" use-attribute-sets="name-list">
<!-- Content:xsl:attribute* -->
</xsl:attribute-set>
屬性
屬性 | 值 | 描述 |
---|---|---|
name | name | 必需。規定屬性集(attribute-set)的名稱。 |
use-attribute-sets | name-list | 可選。在該屬性集(attribute-set)中使用的其他屬性集(attribute-set)的列表,由空格分隔。 |
實例 1
創建可應用到任何輸出元素的屬性集(attribute-set):
<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>
<xsl:attribute name="fname">Arial</xsl:attribute>
<xsl:attribute name="size">14px</xsl:attribute>
<xsl:attribute name="color">red</xsl:attribute>
</xsl:attribute-set>
