Latest web development tutorials

tecla de função () XSLT

objetos função de referência XSLT XSLT Função objetos referência completa

Definição e Uso

tecla de função () do <xsl: key> elemento usando um índice especificado, retorna o conjunto de nós do documento.


gramática

node-set key(string, object)

parâmetros

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

exemplo 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>

Ver o arquivo XML , ver o ficheiro XSL , ver os resultados .


objetos função de referência XSLT XSLT Função objetos referência completa