Use navtitle for topic title

axhxu
Posts: 34
Joined: Thu Aug 27, 2015 9:28 pm

Use navtitle for topic title

Post by axhxu » Thu Feb 07, 2019 3:15 pm

Hi,
Just wondering if there is an easy way to grab the topics navtitle from that map and use that in the topics heading.

It works for the toc. I need the toc heading and the topic heading to match.

Thanks
Arron

Radu
Posts: 6983
Joined: Fri Jul 09, 2004 5:18 pm

Re: Use navtitle for topic title

Post by Radu » Fri Feb 08, 2019 4:09 pm

Hi Aaron,

The navtitle is only used in the table of contents and when links are made to the topic. So by default it does not override the actual title presented when the HTML topic is opened.
There may be a way to achieve what you want. Let's say in the DITA Map you have a topic reference looking like this:

Code: Select all

> <topicref href="topics/introduction.dita" locktitle="yes">
<topicmeta>
<navtitle>ABCDEF</navtitle>
</topicmeta>
</topicref>
If you publish the DITA Map to plain HTML5 or XHTML output and you set the "clean.temp" parameter to "no", in the transformation temporary files folder the topic's content will look something like this:

Code: Select all

<topic..........>
<title............>Original Title</title>
<titlealts class="- topic/titlealts ">
<navtitle>ABCDEF</navtitle>
</titlealts>
so when the XSLT stylesheets which produce the HTML output are applied over the topic they have this information in the topic file.

For example for HTML5-based outputs this XSLT stylesheet:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT3.x/plugins/org.dita.html5/xsl/topic.xsl

has this XSLT template:

Code: Select all

<xsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]">
which could also look at the titlealts/navtitle when deciding the <h1> content.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply