oxy_link-text() Function

You can use this function on the CSS content property to obtain a text description from the source of a reference.

By default, the oxy_link-text() function resolves DITA and DocBook references. For further details about how you can also extend this functionality to other frameworks, go to Configuring an Extensions Bundle.

DITA Support

For DITA, the oxy_link-text() function resolves the xref element and the elements that have a keyref attribute. The text description is the same as the one presented in the final output for those elements. If you use this function for a topicref element that has the navtitle and locktitle attributes set, the function returns the value of the navtitle attribute.

DocBook Support

For DocBook, the oxy_link-text() function resolves the xref element that defines a link in the same document. The text description is the same as the one presented in the final output for those elements.

For the following XML and associated CSS fragments the oxy_link-text() function is resolved to the value of the xreflabel attribute.

<para><code id="para.id" xreflabel="The reference label">my code</code>
      </para>
<para><xref linkend="para.id"/></para>
xref {
    content: oxy_link-text();
}

If the text from the target cannot extracted (for instance, if the href is not valid), you can use an optional argument to display fallback text.

*[class~="map/topicref"]:before{
    content: oxy_link-text("Cannot find the topic reference");
    link:attr(href);
}

Was this helpful?