Adjusting the text in the header section of WebHelp Responsive output

Post here questions and problems related to editing and publishing DITA content.
susannecm
Posts: 86
Joined: Wed Mar 17, 2010 1:04 pm

Adjusting the text in the header section of WebHelp Responsive output

Post by susannecm »

Hi,
I need to write additional information into the title of the WebHelp Responsive output.
From what I have seen, the software uses the mainbooktitle of a bookmap and the title of a map by default.
I would need to add some static text plus the booktitlealt in case of a bookmap and the value of thecontent attribute of an othermeta element named maptitlealt in case of a map. I've already done this for PDF output, but I am not really sure where to start with the webHelp.
My current idea is to override the generatePageTitle template from the file commonComponentsExpander.xsl.
Is this about right?
Thank you for your help
Susanne
Costin
Posts: 795
Joined: Mon Dec 05, 2011 6:04 pm

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by Costin »

Hi Susanne,

There is no dedicated transformation parameter which could be used to do that, but that could be most probably achieved through an XSLT extension, indeed.
For example, you could look at this custom publishing template on GitHub, which we created and uses an XSLT Extension to add a prefix for each topic page title. Maybe you could use that as a starting point.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
susannecm
Posts: 86
Joined: Wed Mar 17, 2010 1:04 pm

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by susannecm »

Hi Costin,
it appears that I wasn't precise enough. I don't want to change the topic title, but the publication title that is displayed above the menu.(see screenshot).
WebHelpResponsiveFlower.jpg
WebHelpResponsiveFlower.jpg (90.43 KiB) Viewed 364 times
Does this also require XSL?
Kind regards
Susanne
cosmin_andrei
Posts: 104
Joined: Mon Jun 12, 2017 10:50 am

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by cosmin_andrei »

Hello,
You could do that through a custom HTML fragment, injected into the resulted WebHelp output. The Oxygen WebHelp offers the possibility to both insert custom HTML content into the output and to reference it from a publishing template or a transformation scenario (in this case we are talking about webhelp.fragment.after.logo_and_title parameter).
More details are available in our user-guide:
https://www.oxygenxml.com/doc/versions/ ... -html.html
Regards,
Cosmin
--
Cosmin Andrei
oXygen XML Editor and Author Support
susannecm
Posts: 86
Joined: Wed Mar 17, 2010 1:04 pm

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by susannecm »

Hello,
unfortunately, I still don't get this to work the way I want it.
I can add static text, but I need to extract data from the bookmap that is converted.
Therefore, I added the following to my publishing template:

Code: Select all

 <parameter name="webhelp.fragment.after.logo_and_title" value="${map-xpath(/bookmap/booktitle/booktitlealt)}"/>
However, the expression is not resolved. Instead, the variable itself is displayed.
Is there a restriction I did not understand?
Kind regards
Susanne
susannecm
Posts: 86
Joined: Wed Mar 17, 2010 1:04 pm

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by susannecm »

Meanwhile, I was able to solve the problem. Apparently, the booktitlealt is already available in the output, but the display property is set to none by default. So I just added this to my WebHelp stylesheet:

Code: Select all

.booktitlealt {
    display: inline !important;
}

.booktitlealt::before {
   content: " - ";
}
I would still be interested to know how I should have used the macro.

Kind regards,
Susanne
alin
Site Admin
Posts: 229
Joined: Thu Dec 24, 2009 11:21 am

Re: Adjusting the text in the header section of WebHelp Responsive output

Post by alin »

Hello,

A macro can be used in the content of an HTML Fragment file. In your case, the content of the fragment file should be:

Code: Select all

<span xmlns:whc="http://www.oxygenxml.com/webhelp/components"> - <whc:macro value="${map-xpath(/bookmap/booktitle/booktitlealt)}"/></span>
You can find more details about macros in our User Manual: https://www.oxygenxml.com/doc/versions/ ... gment_file
The HTML fragment file should be saved in the directory of your publishing template. Then you should reference the fragment file in your publishing template's descriptor file as follows:

Code: Select all

<html-fragments>
      <fragment file="fragments/fragment.xml" placeholder="webhelp.fragment.after.logo_and_title"/>
</html-fragments>
You can find more details about referencing the HTML fragment using a Publishing Template in our User Manual: https://www.oxygenxml.com/doc/versions/ ... ublishing_

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply