<xsl:attribute> 元素用于向元素添加属性。
注释:<xsl:attribute> 元素会替换名称相同的已有属性。
</>code
- <xsl:attribute name="attributename" namespace="uri">
- <!-- Content:template -->
- </xsl:attribute>
属性 | 值 | 描述 |
---|---|---|
name | attributename | 必需。规定属性的名称。 |
namespace | URI | 可选。为属性定义命名空间的 URI。 |
向 picture 元素添加 source 属性:
</>code
- <picture>
<xsl:attribute name="source"/>
- </picture>
向 picture 元素添加 source 属性,并使用 "images/name" 中的值为其赋值:
</>code
- <picture>
<xsl:attribute name="source">
- <xsl:value-of select="images/name" />
</xsl:attribute>
- </picture>
创建能够应用到任何输出元素的属性集:
</>code
- <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>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛