Responsive Webhelp: spaces between different keyword in output

Post here questions and problems related to editing and publishing DITA content.
pieterjan_vdw
Posts: 41
Joined: Wed Jun 20, 2018 11:30 am

Responsive Webhelp: spaces between different keyword in output

Post by pieterjan_vdw »

Hi,

I want to see my keywords in each topic page.
I managed to get them visible in my webhelp via a fragment & Oxygen macro, but can't get spaces between the different keywords in my topic.

Keywords in the DITA topic:

Code: Select all

<keywords>
<keyword>compatibility</keyword>
<keyword>operate</keyword>
<keyword>system</keyword>
<keyword>window</keyword>
</keywords>

XHTML I currently use to get the output:

Code: Select all

<div class="keywords"  xmlns:whc="http://www.oxygenxml.com/webhelp/components">
	<p>Keywords: <b><whc:macro value="${topic-xpath(//keyword)}"/></b></p>
</div>

Final result in HTML:

Code: Select all

<div class="keywords">
	<p>Keywords: <b>compatibilityoperatesystemwindow<whc:macro value="${topic-xpath(//keyword)}"></whc:macro> </b></p>
</div>
How can I get a space between my different keywords in the HTML?
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: Responsive Webhelp: spaces between different keyword in output

Post by alin »

Hello,

You need to adjust your XPath expression in order to concatenate all keywords using a space as separator:

Code: Select all

<div class="keywords"  xmlns:whc="http://www.oxygenxml.com/webhelp/components">
    <p>Keywords: <b><whc:macro value="${topic-xpath(string-join(//keyword, ' '))}"/></b></p>
</div>
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply