modify webhelp content-help-map.xml to include an extra "topic title" attribute

Post here questions and problems related to editing and publishing DITA content.
areilly
Posts: 10
Joined: Thu Dec 07, 2017 5:51 pm

modify webhelp content-help-map.xml to include an extra "topic title" attribute

Post by areilly »

Hello,

I would like to modify the output of the responsive webhelp content-help-map.xml to include an extra "topic title" attribute to make the file more user friendly for developers who are implement the output as online help.

Smething like:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<map>
<appContext helpID="troubles3459" path="mm_test/troubles3459.html" topictitle="Troubleshooting Procedure 1"/>
</map>
I can see that the file I need to add to is com.oxygenxml.webhelp.responsive\xsl\contextHelp\contextHelpMapDita.xsl

Add something like:

Code: Select all

<xsl:attribute name="topictitle" select="$topicTitle"/>
My question is - how do I build this list of topic titles? IS there a template that can be reused for this purpose? Any help much appreciated!
areilly
Posts: 10
Joined: Thu Dec 07, 2017 5:51 pm

Re: modify webhelp content-help-map.xml to include an extra "topic title" attribute

Post by areilly »

Ack. I can't seem to get this to work. I'm nearly there I think. The code gives me what I want for map topicrefs that have navtitles, I just can't seem to figure out to to pull in the titles from the topics themselves.

Code: Select all


    <!-- AR: getTopicTitle template -->
<xsl:template name="getTopicTitle">
<xsl:param name="topic"/>
<xsl:choose>
<xsl:when test="*[contains(@class, ' map/topic ')]/*[contains(@class, ' topic/title ')][@source = 'topic']">
<xsl:value-of select="*[contains(@class, ' map/topic ')]/*[contains(@class, ' topic/title ')][@source = 'topic']"/>
</xsl:when>
<xsl:when test="$topic/toc:title">
<xsl:value-of select="$topic/toc:title"/>
</xsl:when>
<xsl:when test="$topic/@title">
<xsl:value-of select="$topic/@title"/>
</xsl:when>
<xsl:when test="$topic/@navtitle">
<xsl:value-of select="$topic/@navtitle"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- AR: fin -->
Am I missing something obvious or making a basic error about how to grab the topic title?

I included the full file below:
https://gist.github.com/aidanreilly/507 ... fcdeb71a13

:oops: :x :!:
Radu
Posts: 9058
Joined: Fri Jul 09, 2004 5:18 pm

Re: modify webhelp content-help-map.xml to include an extra "topic title" attribute

Post by Radu »

Hi,

You should add an xsl:message on the xsl:template which matches each map/topicref like:

Code: Select all

 <xsl:message>MATCH <xsl:copy-of select="."/></xsl:message>
then publish and look in the DITA OT console for the logged values (Oxygen Preferences->DITA / Logging->Show console output->Always).
The topic title should appear in a topicmeta/navtitle element so you could try to extract it from there.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
areilly
Posts: 10
Joined: Thu Dec 07, 2017 5:51 pm

Re: modify webhelp content-help-map.xml to include an extra "topic title" attribute

Post by areilly »

Thank you Radu! I will try what you suggest :)
Post Reply