XSLT xsl:attribute 元素

定义和用法

<xsl:attribute> 元素用于向元素添加属性。

注释: <xsl:attribute> 元素会替换名称相同的已有属性。

语法

<xsl:attribute name="attributename" namespace="uri">



<!-- Content:template -->



</xsl:attribute>

属性

属性描述
nameattributename必需。规定属性的名称。
namespaceURI可选。为属性定义命名空间的 URI。

实例

例子 1

向 picture 元素添加 source 属性:

<picture>



<xsl:attribute name="source"/>






</picture>

例子 2

向 picture 元素添加 source 属性,并使用 "images/name" 中的值为其赋值:

<picture>



<xsl:attribute name="source">






<xsl:value-of select="images/name" />



</xsl:attribute>






</picture>

例子 3

创建能够应用到任何输出元素的属性集:

<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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值