URLs of New Document Templates
In this section we describe how the URLs of New Document templates relate to design structure, how URLs are edited, and how multiple output-documents can be linked among each other.
URLs of New Document templates
If the New Document template is processed only once (see preceding section), then the template's URL property can be a static URL. In the screenshot below, since the New Document template is immediately within the document element (\$XML), it will be processed only once. The URL has been given a static value of TableOfContents. This value will therefore be the filename of the output-document. Since no path has been prefixed to the filename, the file will be generated in the same directory as the Main Document File (see Multiple Document Outputs and Previews for details). Alternatively, if the URL contained a path, the output-document will be saved to the location specified in the path.
If, on the other hand, a New Document template will be processed multiple times to generate multiple output-documents (see preceding section), then the template's URL property must be a dynamic URL that is selected with an XPath expression. In the screenshot below, the URL of the New Document template is the XPath expression: body/header/para. The New Document template is within the topic element, so it will be processed each time the topic element is processed. On every iteration through the topic element, the content of that topic element's body/header/para element will be assigned as the URL of the New Document template. This creates a new document for every topic element. Each of these documents has a different name, that of its body/header/para element (which is the text of the topic's header).
Editing the URL
When a New Document template is added to the design, it is created with a default URL. This is a static text string: DocumentX (where X is an integer). If you wish to edit the URL, right-click the New Document template and select the command Edit URL. This pops up the Properties dialog (screenshot below), in which you can edit the Value field of the URL without file ext property.
If you wish to enter a static URL, edit the Value field to contain the required URL text. If you wish to enter a dynamic URL, click in the Value field, click the XPath button in the toolbar of the Properties dialog, and enter the XPath expression you want. Note the following: (i) The context node for the XPath expression is the node within which the New Document template has been inserted. (ii) To prefix a path to the XPath location expression, use the concat() function of XPath. For example: concat('C:\MyOutput\', body\header\para). This example expression will generate the URL string: C:\MyOutput\filename. The appropriate file extension will be generated automatically according to the output format.
Multiple output-documents can be linked to one another using bookmarks and hyperlinks. A bookmark can be placed at the head of a New Document Template or anywhere within the New Document Template. Hyperlinks can then be created in other documents to link back to the bookmark. If bookmarks are required on a node that is processed multiple times, then make sure that the name of the bookmark is generated dynamically. Otherwise (if a static bookmark name is given) multiple nodes in the output will have the same bookmark name.
A Table of Contents (TOC) can also be used to link documents. The TOC could be in a separate document (for example, the main document) and link to the various output-documents, while the output-documents could link back to the TOC.