XSLT generate-id()関数


XSLT 函数参考对象完全なXSLT関数リファレンス

定義と用法

generate-id() 関数は、指定されたノードを一意に識別する文字列値を返します。

指定されたノードセットが空の場合は、空の文字列を返します。node-set パラメータを省略した場合は、デフォルトで現在のノードが設定されます。


構文

string generate-id(node-set?)

パラメータ

パラメータ 説明
node-set オプション。一意のIDを生成するノードセットを指定します。

例 1

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

<xsl:template match="/">
<html>
<body>
<h3>Artists:</h3>
<ul>
<xsl:for-each select="catalog/cd">
<li>
<a href="../index.html">
<xsl:value-of select="artist" /></a>
</li>
</xsl:for-each>
</ul>
<hr />
<xsl:for-each select="catalog/cd">
Artist: <a name="{generate-id(artist)}">
<xsl:value-of select="artist" /></a>
<br />
Title: <xsl:value-of select="title" />
<br />
Price: <xsl:value-of select="price" />
<hr />
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

、 、 。


XSLT 函数参考对象完全なXSLT関数リファレンス その他の拡張機能