June 2008
Intermediate to advanced
986 pages
27h 8m
English
[2.0]
unparsed-entity-public-id()
Returns the public ID of the unparsed entity with
the specified name. If there is no such entity, unparsed-entity-public-id()
returns an empty string.
xs:stringunparsed-entity-public-id(xs:string)
The name of the unparsed entity.
The public ID of the unparsed entity with the specified name.
XSLT 2.0 section 16.6, “Miscellaneous Additional Functions.”
Unparsed entities are rarely used; they typically refer to
non-XML data, as in the entity author-picture defined 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 return the public ID of our unparsed entity:
<?xml version="1.0"?> <!-- unparsed-entity-public-id.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>
A test of the unparsed-entity-</xsl:text> <xsl:text>public-id() function:</xsl:text> <xsl:text>

 </xsl:text> <xsl:text>The public ID of the cover image is:
 </xsl:text> <xsl:value-of select="unparsed-entity-public-id(/book/prolog/@cover-image)"/> <xsl:text>.
</xsl:text> </xsl:template> </xsl:stylesheet>
When we transform the XML document with our stylesheet, ...
Read now
Unlock full access