Page 1 of 1

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

Posted: Thu Jan 31, 2019 1:20 pm
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!

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

Posted: Fri Feb 01, 2019 3:12 am
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 :!:

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

Posted: Fri Feb 08, 2019 4:24 pm
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

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

Posted: Tue Feb 12, 2019 3:12 am
by areilly
Thank you Radu! I will try what you suggest :)