unparsed-entity-uri Function

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XSLT Reference

unparsed-entity-uri Function

Returns the URI of the unparsed entity.

string unparsed-entity-uri(string name)

Parameter

Name
The name of the entity desired. The entity must be defined in the same document as the context node.

Return Values

Returns a URI string of the unparsed entity if the entity is defined. Otherwise, it returns an empty string.

Example

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()

  • unparsed-entity-uri('pic') = file:///C:/path/somepic.jpg

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>

See Also

Data Types in Schemas | XDR Schema Data Types Reference | XML Data Types Reference | Initiate XSLT in a Script