local-name 函数

返回 node-set 参数中按文档顺序处于第一位的节点的扩展名称本地部分。

string local-name(node-set?)

备注

扩展名称通常包括命名空间 URI(或关联的前缀)、冒号 (:) 和本地部分。 例如,b:author 是扩展名称,其中 b 是命名空间 URI 前缀,author 是本地部分。 所以,对此节点应用 local-name() 函数将返回 author。 如果节点没有扩展名称,例如 author,对此节点应用 local-name() 函数将返回原始节点名称,即 author

如果省略了 node-set 参数,默认的节点集中唯一的成员是上下文节点。

示例

XML 文件 (data.xml)

XSLT 文件 (sample.xsl)

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

格式化输出

local-name() Function

catalog =

book =

author = Gambardella, Matthew

title = XML Developer's Guide

genre = Computer

price = 44.95

publish_date = 2000-10-01

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

book =

author = Ralls, Kim

title = Midnight Rain

genre = Fantasy

price = 5.95

publish_date = 2000-12-16

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

处理器输出

<html>

<body>

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

</html>

另请参见

参考

XML 数据类型引用