Klawisz XSLT () Funkcja
❮ Odniesienie do funkcji XSLTDefinicja i użycie
Funkcja key() zwraca zestaw węzłów z dokumentu, używając indeksu określonego przez element <xsl:key>.
Składnia
node-set key(string, object)
Parametry
Parameter | Description |
---|---|
string | Required. Specifies the name of an xsl:key element |
object | Required. A string to search for |
Przykład 1
<?xml version="1.0" encoding="UTF-8"?>
<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>
Wyświetl plik XML , Wyświetl plik XSL i Wyświetl wynik .
❮ Odniesienie do funkcji XSLT