Export (0) Print
Expand All

unparsed-entity-uri Function

Returns the URI of the unparsed entity.

string unparsed-entity-uri(string name)

Name

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

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 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:myNamespace">
<!ENTITY pic SYSTEM "somepic.jpg" NDATA JPEG>
]>
<catalog>
<book>
    <title>XML Developer's Guide</title>
</book>
<book>
    <title>Midnight Rain</title>
</book>
</catalog>

<?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>

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>
Show:
© 2014 Microsoft