Insert a Dynamic Text Variable
When you know what elements and attributes you want to use for your dynamic text variables, you add them to your topics. This works for both HTML5 and PDF output.
To write XPath
expressions, there are several things you need to be aware of:
-
Include the "d:" prefix for navigatingthe XML, for example:
${/*[1]/d:info/d:title}$
. The namespace prefixd
is bound to http://docbook.org/ns/docbook -
Some DocBook attributes and Paligo extension attributes do not require a prefix. To access the extension attributes, use the
@xinfo
prefix, for example${@xinfo:time-modified}$
. It will show the date as a computer code, see Dynamic Text Variables for Time and Date for examples of how to make it readable. The namespace prefixxinfo
is bound to http://ns.expertinfo.se/cms/xmlns/1.0. -
For PDF output the top-level node that you can access is
article
. You cannot access the article's parent node (part
).
To insert a dynamic text variable:
-
Select the topic or component in the Content Manager to open it in the Editor.
-
Position the cursor at a valid position for the dynamic text variable.
For example, inside a
para
element. -
Press Alt + Enter ⏎ (Windows) or Command ⌘ + Enter ⏎ (Mac) to display the Element Context Menu.
-
Enter
phrase
and select it from the menu. -
Select the phrase element in the Element Structure Menu and choose Go to element.
-
Add the
role
attribute in the Element Attributes Panel and set its value todyntextvar
.<phrase role="dyntextvar">${}$</phrase>
-
In the
phrase
element, enter the syntax for the relevantXPath expression
to access the element or attribute you want to use.Important
If you use an expression to access an element or attribute that does not exist, the dynamic text variable will be empty (blank) in the output.
-
Select Save.
-
Preview the topic to verify the timestamp.