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. | |
Inputs | |
The name of the unparsed entity. |
|
Output | |
The URI of the unparsed entity with the specified name. |
|
Defined in | |
XSLT section 12.4, Miscellaneous Additional Functions. |
|
Example | |
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() function: The cover image is located at file:///D:/O'Reilly/dougtidwell.jpg. The URI of the unparsed entity is based on the base URI of the XML document itself. |