Altova StyleVision 2024 Enterprise Edition

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, and is therefore only available in the outputs (HTML, RTF, PDF, Word 2007+); not in Authentic View. Note that unparsed entity URIs are not processed for Text 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.

 

Declaring and referencing 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 "https://www.altova.com" NDATA LNK>

]>

<document>

  <header>Example of How to Use Unparsed Entity URIs</header>

  <para>...</para>

  <img src="Picture"/>

  <link href="AltovaURI">Link to the Altova Website.</link>

</document>

 

SPS images and hyperlinks that use unparsed entities

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.

 

dlg_insert_image_unparsedEntity

 

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.

 

© 2017-2023 Altova GmbH