当前位置:K88软件开发文章中心编程语言XmlXSLT01 → 文章内容

XSLT key() 函数

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-26 18:46:59

由 gelin678 创建,Carrie 最后一次修改 2015-09-29 XSLT key() 函数 完整的 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 <xsl:key> 元素

XSLT key() 函数