XSLT key() 函数

2018-02-12 18:06 更新

XSLT key() 函数


XSLT 函数参考对象 完整的 XSLT 函数参考对象

定义和用法

key() 函数通过使用由 <xsl:key> 元素规定的索引号,从文档中返回节点集。


语法

node-set key(string, object)

参数

参数 描述
string 必需。规定 xsl:key 元素的名称。
object 必需。要搜索的字符串。

实例 1

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:key name="cdlist" match="cd" use="title" />

<xsl:template match="/">
<html>
<body>
<xsl:for-each select="key('cdlist', 'Empire Burlesque')">
<p>
Title: <xsl:value-of select="title" />
<br />
Artist: <xsl:value-of select="artist" />
<br />
Price: <xsl:value-of select="price" />
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

XSLT 函数参考对象 完整的 XSLT 函数参考对象

相关文章

XSLT <xsl:key> 元素

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号