当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT <xsl:attribute> 元素

XSL/XSLT
XSL 语言
XSLT 介绍
XSLT 浏览器
XSLT 转换
<xsl:template>
<xsl:value-of>
<xsl:for-each>
<xsl:sort>
<xsl:if>
<xsl:choose>
<xsl:apply-templates>
XSLT - 客户端
XSLT - 服务器端
XSLT - 编辑XML
XSLT 摘要
XSLT 元素参考
XSLT 函数
XSL 编辑器

XSL/XSLT 中的 XSLT <xsl:attribute> 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 256 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The <xsl:attribute> element is used to add attributes to elements.
<xsl:attribute> 元素的作用是:给元素添加属性。

Note: The <xsl:attribute> element replaces existing attributes with equivalent  names.
注意:<xsl:attribute> 元素将用相同的名称替换现有属性。



Syntax
语法

<xsl:attribute name="attributename" namespace="uri">
 <!-- Content:template -->
</xsl:attribute>

Attributes
属性

属性 描述
name attributename Required. Specifies the name of the attribute
必要参数。指定属性名称
namespace URI Optional. Defines the namespace URI for the attribute
可选参数。为属性定义命名空间的URI

Example 1
案例1

Add a source attribute to the picture element:
将一个source[源]属性添加到图片元素中:

<picture> <xsl:attribute name="source"/>
</picture>

Example 2
案例2

Add a source attribute to the picture element and fill it with values from "images/name" :
将一个source[源]属性添加到图片元素中,并用"images/name"中的值对其进行填充:

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

Example 3
案例3

Create an attribute-set that can be applied to any output element:
创建一个可以应用于所有output[结果]元素的属性值:

<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) All

登陆 | 还没注册?