Latest web development tutorials

ที่สำคัญ XSLT () ฟังก์ชัน

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>

ดูไฟล์ XML , ดูไฟล์ XSL , ดูผลลัพธ์


XSLT วัตถุฟังก์ชั่นการอ้างอิง วัตถุอ้างอิง XSLT ฟังก์ชั่นที่สมบูรณ์