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

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:元素> 元素


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

Definition and Usage
定义和用法

The <xsl:element> element is used to create an element node in the output document.
<xsl:element>元素的作用是:在输出文档中创建一个元素节点。


Syntax
语法

<xsl:element
name="name"
namespace="URI"
use-attribute-sets="namelist">
 <!-- Content:template -->
</xsl:element>

Attributes
属性

属性 描述
name name Required. Specifies the name of the element to be created (the value of the name attribute can be set to an expression that is computed at run-time, like this: <xsl:element name="{$country}" />
必要参数。指定创建的元素名称(name[名称]属性值可以设置成用于计算运行时间的表达式,如:<xsl:element name="{$country}" />)
namespace URI Optional. Specifies the namespace URI of the element (the value of the namespace attribute can be set to an expression that is computed at run-time, like this: <xsl:element name="{$country}" namespace="{$someuri}"/>
可选参数。指定元素的命名空间URI(namespace[命名空间]属性可以设置为用于计算运行时间的表达式,如:<xsl:element name="{$country}" namespace="{$someuri}"/>)
use-attribute-sets namelist Optional. A white space separated list of attribute-sets containing attributes to be added to the element
可选参数。指定用于分隔属性组之间的属性的空白(属性已被添加到元素中)。

Example 1
案例1

Create a "singer" element that contains the value of each artist element:
创建一个“singer”元素,该元素包含了每个artist元素的值,具体如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/"> <xsl:for-each select="catalog/cd"> <xsl:element name="singer"> <xsl:value-of select="artist" /> </xsl:element> <br /> </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

查看XML 文件XSL 文件以及结果

评论 (0) All

登陆 | 还没注册?