Page 1 of 1

Adjusting the text in the header section of WebHelp Responsive output

Posted: Wed Sep 14, 2022 8:58 pm
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

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

Posted: Thu Sep 15, 2022 12:10 pm
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

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

Posted: Thu Sep 15, 2022 9:23 pm
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 986 times
Does this also require XSL?
Kind regards
Susanne

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

Posted: Mon Sep 19, 2022 4:48 pm
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

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

Posted: Wed Oct 12, 2022 2:08 pm
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

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

Posted: Wed Oct 12, 2022 3:52 pm
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

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

Posted: Thu Oct 13, 2022 6:35 pm
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