| unparsed-entity-uri() 関数 | |
| 指定した名前の未解析エンティティの URI を返します。このようなエンティティがない場合、unparsed-entity-uri は空の文字列を返します。 | |
| 入力 | |
|
未解析エンティティの名前。 |
|
| 出力 | |
|
指定した名前の未解析エンティティの URI。 |
|
| 定義先 | |
|
XSLT 12.4 節「Miscellaneous Additional Functions」 |
|
| 例 | |
|
未解析エンティティはほとんど使用されません。次の XML ドキュメントのエンティティ author-picture のように、未解析エンティティは非 XML データを参照します。
<?xml version="1.0"?>
<!DOCTYPE book [
<!ENTITY author-picture SYSTEM "dougtidwell.jpg" NDATA JPEG>
]>
<book>
<prolog cover-image="author-picture"/>
<body>
<p>Pretend that lots of useful content appears here.</p>
</body>
</book>
このスタイルシートを使用して未解析エンティティを処理します。
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="newline">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$newline"/>
<xsl:text>A test of the unparsed-entity-uri() function:</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
<xsl:text> The cover image is located at </xsl:text>
<xsl:value-of select="unparsed-entity-uri(/book/prolog/@cover-image)"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="$newline"/>
</xsl:template>
</xsl:stylesheet>
例のスタイルシートを使用して XML ドキュメントを変換した結果は次のとおりです。 A test of the unparsed-entity-uri() function: The cover image is located at file:///D:/O'Reilly/dougtidwell.jpg. 未解析エンティティの URI は、XML ドキュメント自体のベース URL に基づいています。 |
|