How to post fill a link text of a cross reference
This concept explains how to extend the file TemplateSpecification.xml with specializations of the variable 'selecteditem:text'.
In our OOTB system we will have as default: selecteditem:text. Which will result in an empty link text when 'Text to display' in the user interface is left empty.
This can be customized by changing it to:
| Custom variable | Explanation |
|---|---|
| selecteditem:textortitle | When 'Text to display' is empty the link text will be filled with the logical title of the referenced object. |
| selecteditem:textordefault | When 'Text to display' is empty the link text will be filled with the title of the referenced element, if the element has a title. |
For Example:
<templateSpecification>
<linktemplates>
<template id="LINK-DITA-TOPICREF" name="topicref">
<documentFragment>
<topicref href="selecteditem:href">
<topicmeta>
<navtitle>selecteditem:textortitle</navtitle>
</topicmeta>
</topicref>
</documentFragment>
</template>
</linktemplates>
<hyperlinktemplates>
<template id="HYPERLINK-DITA-XREF" name="xref">
<documentFragment>
<xref href="selecteditem:href">selecteditem:textortitle</xref>
</documentFragment>
</template>
</hyperlinktemplates>
</templateSpecification>