Inheritance concept (classic)
This page is about "classic" templates. You can find more information here.
Each template or template type provides its part to complete the final document. For example, the style template provides all the font formatting. The different template types can thus be combined in any way and exchanged or updated at any time. This avoids redundancies in template construction. The documents are always regenerated at runtime.
CAUTION
If your templates and/or snippets are constantly changed, it cannot be guaranteed that documents generated and saved in the past will still work when you update them again. The reason for this is that the document was saved in different circumstances. It now points to the new version of the template when it is reopened and updated.
This graph shows the maximum inheritance level – each level is optional.
The document pipeline contains a template specific list of functions that are realized as plug-ins and are loaded when primedocs is started. Which document functions are used in which order in a template is defined by the template editor in the administration view of the client. Document functions contain self-contained procedures that are applied to the document, interfaces, etc.
NOTE
We use the terms "higher" and "lower", according to the graph above:
Higher means that the document function has been defined on a style, for example.
Lower means that the document function has been defined closer to the actual document.
Document function inheritance
All document functions configured on the templates at the various levels in the template inheritance system are combined in a chain. Each document function is added only once. If a document function is added to a function template, for example, it will be executed at the end of the execution order.
However, there are exceptions: Due to the system, some document functions are automatically moved to the end of the chain. This applies, for example, to the document functions "Scripts" or "Library for advanced binding" (Extended bindings).
Active and deactivated document functions
If you define the document function "document parameter" on style level, all templates based on the style inheriting this function have this function automatically attached as well. If you now deactivate the document parameter in the content template, it will be deactivated for the document generation as a whole.
Overwrite configuration
If you define a document function on different levels, the following rule applies for most document functions: The configuration that was configured closer to the final document is selected in the Document Engine.
Exception to this rule is e.g., the document function "Scripts": Here the different dataNodes from each level are put together, so that in the end all scripts from all levels can be run through.
Transformation
Besides overwriting or activating/deactivating a higher document function, there is also the possibility to specifically overwrite configuration entries from a higher level (e.g. Style). This kind of configuration allows to make very precise changes to an existing configuration. However, this requires familiarization with the "XDT" transformations.
A transformation is only started if the following XML namespace is applied:
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"
Without this XML namespace the normal merge mechanism is used, which mostly replaces the whole configuration with the higher one.
Scenario:
Layout template with document function "Formatting":
<DocumentFunction>
<!-- Parameterization of the headings -->
<Group name="Headings">
<Definition type="Heading" level="1" style="Heading 1" />
<Definition type="Heading" level="2" style="Heading 2" />
<Definition type="Heading" level="3" style="Heading 3" />
<Definition type="Heading" level="4" style="Heading 4" />
</Group>
<!-- Parameterization of the tabulators -->
<Group name="Indents" maxListLevels="4" />
<!-- Parameterization of lists, enumerations and numbering -->
<Group name="NumberingStyles">
<Definition type="Numeric" tabPosition="1" style="ListNumeric" />
<Definition type="Alphabetic" tabPosition="1" style="ListAlphabetic" />
<Definition type="Bullet" tabPosition="1" style="ListBullet" />
<Definition type="Line" tabPosition="1" style="ListLine" />
</Group>
<!-- Parameterization of numbering options -->
<Group name="NumberingBehaviors">
<Definition type="Increment" style="ListNumeric" />
<Definition type="Decrement" />
<Definition type="ResetChapter" style="Heading 1" />
<Definition type="ResetList" style="ListNumeric" />
</Group>
<!-- Parameterization of formatting options -->
<Group name="Styles">
<Definition type="Normal" style="Normal" />
<Definition type="Bold" style="" />
<Definition type="Italic" style="" />
<Definition type="Underline" style="" />
</Group>
<!-- Parameterization of further formatting options -->
<Group name="CustomStyles">
<Category id="Headings">
<Label>Headings</Label>
<Definition type="Title" style="Title">
<Label>Title</Label>
</Definition>
<Definition type="Subtitle" style="Subtitle">
<Label>Subtitle</Label>
</Definition>
</Category>
<Category id="Various">
<Label>Various</Label>
<Definition type="Emphasis" style="Emphasis">
<Label>Emphasis</Label>
</Definition>
</Category>
</Group>
</DocumentFunction>
Now other headings are to be used in a certain Word template. Without transformation, the whole content would have to be copied between the DocumentFunction
tags and then modified. With transformation only a section of the configuration can be defined. Thereby the sections are added as follows:
Whole groups are transformed:
xdt:Transform="Replace" xdt:Locator="Match(name)
Only a single line is transformed:
xdt:Transform="Replace" xdt:Locator="Match(type)"
Here are a few examples:
<DocumentFunction xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <!-- ← Indiziert, dass hier transformiert wird. -->
<!-- Overwrite headings | whole group -->
<Group name="Headings" xdt:Transform="Replace" xdt:Locator="Match(name)">
<Definition type="Heading" level="1" style="Heading1NotNumbered" />
<Definition type="Heading" level="2" style="Heading2NotNumbered" />
<Definition type="Heading" level="3" style="Heading3NotNumbered" />
<Definition type="Heading" level="4" style="Heading4NotNumbered" />
</Group>
<!-- Overwrite the tabulators | whole group -->
<Group name="Indents" maxListLevels="2" xdt:Transform="Replace" xdt:Locator="Match(name)" />
<!-- Overwrite the numbering options | single line -->
<Group name="NumberingBehaviors">
<Definition type="Increment" style="ListAlphabetic" xdt:Transform="Replace" xdt:Locator="Match(type)" />
</Group>
<!-- Overwrite formatting options | single line -->
<Group name="Styles">
<Definition type="Normal" style="No Spacing" xdt:Transform="Replace" xdt:Locator="Match(type)" />
</Group>
<!-- Overwrite further formatting options | whole group -->
<Group name="CustomStyles" xdt:Transform="Replace" xdt:Locator="Match(name)">
<Category id="Headings">
<Label>Headings</Label>
<Definition type="Title" style="Title">
<Label>Title</Label>
</Definition>
</Category>
</Group>
</DocumentFunction>
It is also possible to chain several transformations one after the other, for example, in order for a function template to transform the existing configuration again:
A complete documentation about all XDT actions can be found in MSDN.
PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland