If you are using a DTD and have declared an unparsed entity in it, you can use the URI associated with that entity for image and hyperlink targets in the SPS. This is useful if you wish to use the same URI multiple times in the SPS. This feature makes use of the XSLT function unparsed-entity-uri to pass the URI of the unparsed entity from the DTD to the output.
Using this feature requires that the DTD, XML document, and SPS documents be appropriately edited, as follows:
1.In the DTD, the unparsed entities must be declared, with (i) the URI, and (ii) the notation (which indicates to StyleVision the resource type of the entity).
2.In the XML document, the unparsed entity must be referenced. This is done by giving the names of the required unparsed entities.
3.In the SPS, unparsed entities can be used to target images and hyperlinks by correctly accessing the relevant dynamic node values as unparsed entities.
Given below is a cut-down listing of an XML document. It has an internal DTD subset which declares two unparsed entities, one with a GIF notation (indicating a GIF image) and the other with an LNK notation (indicating a hyperlink). The img/@src and link/@href nodes in the XML code reference the unparsed entities by giving their names.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "UEURIDoc.dtd" [
<!ENTITY Picture SYSTEM "nanonull.gif" NDATA GIF>
<!ENTITY AltovaURI SYSTEM "http://www.altova.com" NDATA LNK>
<header>Example of How to Use Unparsed Entity URIs</header>
<link href="AltovaURI">Link to the Altova Website.</link>
Images and hyperlinks in the SPS that reference unparsed entity URIs are used as follows:
1.Insert the image or hyperlink via the Insert menu.
2.In the object's Edit dialog, select the Dynamic tab properties (screenshot below), and enter an XPath expression that selects the node containing the name of the unparsed entity. In the XML document example given above, these nodes would be, respectively, the //img/@src and //link/@href nodes.
|3.||Then check the Treat as Unparsed Entity check box at the bottom of the dialog. This causes the content of the selected node to be read as an unparsed entity. If an unparsed entity of that name is declared, the URI associated with that unparsed entity is used to locate the resource (image or hyperlink).|
When the stylesheet is processed, the URI associated with the entity name is substituted for the entity name.
|Note:||If the URI is a relative URI, then the XSLT processor expands it to an absolute URI applying the base URI of the DTD. For example, if the unparsed entity is associated with the relative URI "nanonull.gif", then this URI will be expanded to file:///c:/someFolder/nanonull.gif, where the DTD is in the folder someFolder.|