name 函数

返回的字符串包含一个 QName,该 QName 表示 node-set 参数中按文档顺序处于第一位的节点的扩展名称。

string name(node-set?)

备注

QName 必须表示相对于节点上的有效命名空间的扩展名称。 如果节点上的有效命名空间声明将多个前缀与同一个命名空间关联,则不需要这样。 如果 node-set 参数是空的或第一个节点没有扩展名称,则返回空字符串。 如果省略了该参数,默认的节点集中唯一的成员是上下文节点。

示例

XML 文件 (bcat.xml)

XSLT 文件 (sample.xsl)

辅助 XSLT 文件 (book-schema.xml)

格式化输出

name() Function

b:catalog =

b:book =

b:author = Gambardella, Matthew

b:title = XML Developer's Guide

b:genre = Computer

b:price = 44.95

b:publish_date = 2000-10-01

b:description = An in-depth look at creating applications with XML.

b:book =

b:author = Ralls, Kim

b:title = Midnight Rain

b:genre = Fantasy

b:price = 5.95

b:publish_date = 2000-12-16

b:description = A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.

处理器输出

<html>

<body>

<h3>name() Function</h3>b:catalog = <br>b:book = <br>b:author = Gambardella, Matthew<br>b:title = XML Developer's Guide<br>b:genre = Computer<br>b:price = 44.95<br>b:publish_date = 2000-10-01<br>b:description = An in-depth look at creating applications with XML.<br>b:book = <br>b:author = Ralls, Kim<br>b:title = Midnight Rain<br>b:genre = Fantasy<br>b:price = 5.95<br>b:publish_date = 2000-12-16<br>b:description = A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.<br></body>

</html>

另请参见

参考

XML 数据类型引用