conref in title not in WebHelp book title

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

conref in title not in WebHelp book title

Post by rdelong » Thu Aug 20, 2015 11:22 pm

I have a ditabase topic that is a topicref in the frontmatter in my bookmap. The title of this topic contains a conref to a product name, followed by text. The purpose of course is to make this title the book title in my WebHelp output.

In the WebHelp output, only the text displays in the top banner that displays the book title. Can you tell my how to get the full title to show up in the top banner and not just the text?

What's strange is that this topic title shows up correctly in the TOC and the HTML output for that page looks OK.

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

Re: conref in title not in WebHelp book title

Post by Radu » Fri Aug 21, 2015 9:31 am

Hi,

I don't quite understand your entire setup. The top banner in the default WebHelp output displays the value of the bookmap <mainbooktitle> element, so it is not connected to the title of the first topic referenced in the map frontmatter.
The title of each topic should be displayed in the TOC and in the right part of the frameset. From what I tested (WebHelp produced with Oxygen 17.0), it gets properly displayed.
If you still have problems with this, please try to give us more details, maybe send a small DITA project which exhibits the problem to our email address support at oxygenxml dot com.
Also, what Oxygen version are you using? Have you customized the WebHelp output in any way?

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

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: conref in title not in WebHelp book title

Post by rdelong » Fri Aug 21, 2015 7:15 pm

Sorry about that. Yes, that portion of the plugin (v15) was customized. I set the code back to the default and it works as you describe. However, I do need to figure out how to use the topic title of the first topicref instead here.

On a side note, can you explain this code that resides in the default com.oxygenxml.webhelp/xsl/createMainFiles.xsl, line 91:

Code: Select all

<xsl:when test="$toc/toc:title">
<xsl:apply-templates select="$toc/toc:title/node()" mode="copy-xhtml"/>
</xsl:when>
I can't figure out how the plugin knows that selecting

Code: Select all

$toc/toc:title/node()
can pick up the /bookmap/booktitle/mainbooktitle. I've never seen /toc:title XPath before. An explanation would be helpful to me in my understanding of this plugin.

Thanks

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

Re: conref in title not in WebHelp book title

Post by Radu » Mon Aug 24, 2015 9:49 am

Hi,

The way that the TOC processing works is that first an XSLT stylesheet called:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\tocDita.xsl

which is applied over the merged DITA Map and then creates a custom TOC XML document. You can look in that XSLT at the template:

Code: Select all

<xsl:template match="/">
to see how the TOC title gets computed.

On that custom TOC XML document the createMainFiles.xsl is applied to create the XHTML TOC equivalent.

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

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: conref in title not in WebHelp book title

Post by rdelong » Tue Aug 25, 2015 4:18 am

Thanks for the explanation.

Unfortunately, I still can't figure out how to get the title of the first topic title to display in the top banner of the output. Can you help with this?

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

Re: conref in title not in WebHelp book title

Post by Radu » Tue Aug 25, 2015 9:25 am

Hi,

So in the tocDita.xsl I previously mentioned there is a template:

Code: Select all


<xsl:template match="/">
.........
in which there is an xsl:choose element. You can comment that out and instead of it use:

Code: Select all

                <xsl:variable name="firstTopicref" select="(//*[contains(@class, ' map/topicref ')][@href])[1]"/>
<xsl:choose>
<xsl:when test="$firstTopicref/*[contains(@class, ' map/topicmeta ')]/*[contains(@class, ' topic/navtitle ')]">
<xsl:apply-templates
select="$firstTopicref/*[contains(@class, ' map/topicmeta ')]/*[contains(@class, ' topic/navtitle ')]"
mode="toc-title"/>
</xsl:when>
<xsl:when test="$firstTopicref/@navtitle">
<xsl:value-of select="$firstTopicref/@navtitle"/>
</xsl:when>
</xsl:choose>
You can change the select value of the firstTopicref variable to match your specific case.

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

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: conref in title not in WebHelp book title

Post by rdelong » Thu Aug 27, 2015 6:13 pm

Thanks!

It makes perfect sense now that I see the solution! This works great.

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: conref in title not in WebHelp book title

Post by rdelong » Thu Sep 03, 2015 2:42 am

I've implemented this update, but how to I test for a specific $transtype? I'd like to restrict this change to only webhelp-mobile transtypes.

I've tried adding <xsl:param name="TRANSTYPE"/> to the tocDita.xsl file, but it doesn't seem to work. For example,

Code: Select all


<xsl:choose>
<xsl:when test="$TRANSTYPE = 'webhelp-mobile'">
.... do whatever
</xsl:when>
<xsl:otherwise>
..... do something else
</xsl:otherwise>
</xsl:choose>
What am I doing wrong?

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

Re: conref in title not in WebHelp book title

Post by Radu » Thu Sep 03, 2015 9:43 am

Hi,

After you defined the:

Code: Select all

 <xsl:param name="TRANSTYPE"/>
parameter in the XSLT stylesheet you need to pass the proper value to it from the build file.
In your case, if you open the build file:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\build_dita.xml

at some point it has an XLST task like:

Code: Select all

<xslt processor="trax" 
in="${dita.temp.dir}/${user.input.file}"
out="${output.dir}/toc.xml"
style="${dita.dir}/plugins/com.oxygenxml.webhelp/xsl/dita/tocDita.xsl"
force="yes"
classpathref="dost.class.path">
to which you can add an extra parameter like:

Code: Select all

      <param name="TRANSTYPE" expression="${transtype}"/>
So what you are actually doing is to pass the parameter value from the ANT build files (where it is already defined) to the XSLT stylesheet where you can use it in the templates.

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

rdelong
Posts: 71
Joined: Tue Oct 21, 2014 10:01 pm

Re: conref in title not in WebHelp book title

Post by rdelong » Thu Sep 03, 2015 7:45 pm

Thank you for the informative explanation. This feature is working now as expected.

Post Reply