August 2001
Intermediate to advanced
480 pages
11h 16m
English
unparsed-entity-uri() Function — Returns the URI of the unparsed entity with the specified name. If there is no such entity, unparsed-entity-uri returns an empty string.
stringunparsed-entity-uri(string)
The name of the unparsed entity.
The URI of the unparsed entity with the specified name.
XSLT section 12.4, Miscellaneous Additional Functions.
Unparsed entities are rarely used; they refer to non-XML data, as in the entity author-picture in this XML document:
<?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>We’ll use this stylesheet to process our unparsed entity:
<?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>When we transform the XML document with our stylesheet, the results look like this:
A test of the unparsed-entity-uri() ...