Returns the URI of the unparsed entity.
string unparsed-entity-uri(string name)
Returns a URI string of the unparsed entity if the entity is defined. Otherwise, it returns an empty string.
This example demonstrates the unparsed-entity-uri()
function to retrieve the path of the image file, somepic.jpg
, which has been associated with the pic
entity.
XML File (data.xml)
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="sample.xsl"?> <!DOCTYPE catalog [ <!ELEMENT catalog ANY> <!ELEMENT book ANY> <!ELEMENT title ANY> <!NOTATION JPEG SYSTEM "urn:foo"> <!ENTITY pic SYSTEM "somepic.jpg" NDATA JPEG> ]> <catalog> <book> <title>XML Developer's Guide</title> </book> <book> <title>Midnight Rain</title> </book> </catalog>
XSLT File (sample.xsl)
<?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <html> <body> <h3>unparsed-entity-uri()</h3> <ul> <li> <b>unparsed-entity-uri('pic')</b> = <xsl:value-of select="unparsed-entity-uri('pic')"/> </li> </ul> </body> </html> </xsl:template> </xsl:stylesheet>
Output
This is the formatted output:
unparsed-entity-uri()
This is the processor output:
<html> <body> <h3>unparsed-entity-uri()</h3> <ul> <li><b>unparsed-entity-uri('pic')</b> = file:///C:/path/somepic.jpg </li> </ul> </body> </html>
Data Types in Schemas | XDR Schema Data Types Reference | XML Data Types Reference | Initiate XSLT in a Script