Customizing WebHelp Responsive header

Post here questions and problems related to editing and publishing DITA content.
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Customizing WebHelp Responsive header

Post by Pascale »

Hi,
we have a custom DITA map DTD, with additional metadata that we want to show in the header in a customized WebHelp Responsive plugin, as part of the title.
For example, we want to display the product name before and the document version after the title's text, and the entire string must be included in the link ('<a href=...>)' element.
Can you please explain how we can achieve this ?
Is there a parameter, an extension-point or an element of the publishing template that we can customize ?

Kind regards,
Pascale
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: Customizing WebHelp Responsive header

Post by Pascale »

Hi,
any idea on this ?
Would it help if I re-formulate my question as : how can I customize the <whc:webhelp_publication_title> component ?

Pascale
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: Customizing WebHelp Responsive header

Post by alin »

Hello,

You can retrieve metedata info from your input map using the macros template components: https://www.oxygenxml.com/doc/versions/ ... gment_file.

You can add content before and after the <whc:webhelp_publication_title> component by expanding it in the HTML Layout files as follows:

Code: Select all


<whc:webhelp_publication_title>
<!-- Content before component content -->

<whc:component_content/>

<!-- Content after component content -->
</whc:webhelp_publication_title>
This support is available for all whc:* template components.

Supposing you have the following metadata in your DITA map:

Code: Select all


<map>
<title>Growing Flowers</title>

<topicmeta>
<prodinfo>
<prodname>My product</prodname>
<vrmlist>
<vrm version="20.1"/>
</vrmlist>
</prodinfo>
</topicmeta>
.....
</map>
You can use the map-xpath macro to retireve the product name and the product version from the DITA map and insert these data before and after the publication title as follows:

Code: Select all



<whc:webhelp_publication_title>
<span class="wh_publication_title before-title">
<a href="${path(oxygen-webhelp-output-dir)}/index.html">
<span>[<whc:macro value="${map-xpath(/map/topicmeta/prodinfo[1]/prodname/text())}"/>]</span>
</a>
</span>

<whc:component_content/>

<span class="wh_publication_title after-title">
<a href="${path(oxygen-webhelp-output-dir)}/index.html">
<span>[v. <whc:macro value="${map-xpath(/map/topicmeta/prodinfo[1]/vrmlist/vrm[1]/@version)}"/>]</span>
</a>
</span>
</whc:webhelp_publication_title>
Note that you will obtain 3 <a> elements: one for the content before, one for the actual title and one for the content after the title.
You can customize the styles for the added content by providing additional CSS to the WebHelp Responsive transformation: https://www.oxygenxml.com/doc/versions/ ... h-css.html

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: Customizing WebHelp Responsive header

Post by Pascale »

Thanks for your answer, however I need more details.

Do I need a "myCustomWebHelp" plugin or is it feasible simply by creating a new custom publishing template ?
In the later case, in which file should I add the code ?

TIA,
Pascale
Costin
Posts: 827
Joined: Mon Dec 05, 2011 6:04 pm

Re: Customizing WebHelp Responsive header

Post by Costin »

Hi Pascale,
Do I need a "myCustomWebHelp" plugin or is it feasible simply by creating a new custom publishing template ?
You do not need to create a custom plugin, you should just use Alin's suggestion in a publishing template.
In the later case, in which file should I add the code ?
In the "header.xml" file, located inside the "page-templates" folder from your custom publishing template folder. In order for the "page-templates" folder to be generated inside the exported publishing template, you should make sure you enable the "Include HTML Layout Files" option when exporting the publishing template from the transformation scenario configuration dialog.

More specific, that option is available in the "Save Template As..." dialog you obtain when saving (exporting) a publishing template, after you configured your transformation scenario.

I hope this helps.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Post Reply