Name

unparsed-entity-uri()

Returns the URI of the unparsed entity with the specified name. If there is no such entity, unparsed-entity-uri returns an empty string.

Syntax

[1.0] string unparsed-entity-uri(string)
[2.0] xs:anyURI unparsed-entity-uri(xs:string)

Inputs

The name of the unparsed entity.

Output

The URI of the unparsed entity with the specified name.

Defined in

[1.0] XSLT section 12.4, “Miscellaneous Additional Functions.”

[2.0] XSLT section 16.6, “Miscellaneous Additional Functions.”

Example

Unparsed entities are rarely used; they typically refer to non-XML data, as in the entity author-picture in this XML document:

<?xml version="1.0"?>
<!-- unparsed-entity.xml -->
<!DOCTYPE book [
  <!ENTITY author-picture PUBLIC "-//OReilly//Author Images//DT"
    "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 get the public URI of our unparsed entity:

<?xml version="1.0"?>
<!-- unparsed-entity-uri.xsl -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:text>&#xA;A test of the unparsed-entity-</xsl:text>
    <xsl:text>uri() function:</xsl:text>

    <xsl:text>&#xA;&#xA;   </xsl:text>
    <xsl:text>The URI of the cover image is:&#xA;      </xsl:text>
    <xsl:value-of 
      select="unparsed-entity-uri(/book/prolog/@cover-image)"/>
    <xsl:text>.&#xA;</xsl:text>
  </xsl:template>

</xsl:stylesheet>

When we transform ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.