Page 1 of 1

WebHelp Responsive: Related Links as one category

Posted: Mon Aug 29, 2016 1:01 pm
by Anonymous1
Hi,

is there a way to avoid having the related links separated by topic type (concept, task, reference)?

I'd rather have one "Related links" section with all related links in it instead of "Related reference", "Related task", "Related concept".

Thank you,

Benjamin

Re: WebHelp Responsive: Related Links as one category

Posted: Mon Aug 29, 2016 3:04 pm
by radu_pisoi
Hi,

The below response assumes that you are using the reltable element within a DITA map to declare all relationships among topics. In this case, you can control the generated labels by specify your custom labels in the reltable header:

Code: Select all

<reltable>
<relheader>
<relcolspec>
<title>Related links</title>
</relcolspec>
<relcolspec>
<title>Related links</title>
</relcolspec>
</relheader>

<relrow>
<relcell>
<topicref href="topic1.dita"/>
</relcell>
<relcell>
<topicref href="topic2.dita"/>
<topicref href="topic3.dita"/>
</relcell>
</relrow>
</reltable>

Re: WebHelp Responsive: Related Links as one category

Posted: Mon Aug 29, 2016 3:09 pm
by Anonymous1
Sorry, I should have given more information.

We are using the <related-links> element.

Code: Select all

    <related-links>
<linkpool>
<link href="bla1_c.xml#bla1_c"/>
<link href="bla2_t.xml#bla2_t"/>
<link href="bla3_t.xml#bla3_t"/>
</linkpool>
</related-links>

Re: WebHelp Responsive: Related Links as one category

Posted: Tue Aug 30, 2016 12:33 pm
by radu_pisoi
You can use the linklist element instead of linkpool because it allows you to set a title/label.

Code: Select all

<related-links>
<linklist>
<title>Related links</title>
<link href="bla1_c.xml#bla1_c"/>
<link href="bla2_t.xml#bla2_t"/>
<link href="bla3_t.xml#bla3_t"/>
</linklist>
</related-links>

Re: WebHelp Responsive: Related Links as one category

Posted: Wed Aug 31, 2016 12:46 pm
by Anonymous1
Thank your for the suggestion. I tried that solution and it works. However, all our documentation content uses the <linkpool> element, the authors are used to it.

Is there a way to change the output in another way without having to switch from linkpool to linklist? If not, I need to evaluate the effort to change our related links.

Re: WebHelp Responsive: Related Links as one category

Posted: Wed Aug 31, 2016 4:01 pm
by radu_pisoi
B-E-N wrote:Is there a way to change the output in another way without having to switch from linkpool to linklist? If not, I need to evaluate the effort to change our related links.
I'm afraid that there is no simple solution to change output as you like. Maybe you can try with a custom JavaScript.

But I think you can easily change your topics by using the XML Refactoring tool. You can see a video presentation for this tool: https://www.oxygenxml.com/demo/XML_Refactoring.html

For your use case, I think you should execute two XML Refactoring operations: one to rename all 'linkpool' elements to 'linklist' and another to insert the title element as first child of the 'linklist' element.

To rename the 'linkpool' element to 'linklist':
1. Use the 'Refactoring -> XML Refactoring' action from the contextual menu of the DITA map;
2. Choose the 'Rename element' operation;
3. Complete the labels for Target Elements and New local name;
4. Leave the 'Current DITA map hierarchy' scope selected;
5. Preview and accept the changes.

For the second operation, to insert the title element, you can use the 'Insert XML fragment' operation. Complete the fragment you want to insert: <title>Related links</title> and for XPath you could use: linklist[not(title)] (linklist without title). Select the 'First child' position.

Re: WebHelp Responsive: Related Links as one category

Posted: Thu Dec 15, 2016 6:35 pm
by Anonymous1
Thanks for posting the procedure. I just got around to try this out, but ended up getting an error. An error I get often when I try to use the XML Refactoring. I used to think that I am not using the tool correctly, but maybe it's something else.

Here is what I did (after the first part of your explanation worked very well):
1. <title>Related links</title>
2. XPath: linklist[not(title)]
3. 'First child' position

This procedure gives me the following errors:

Code: Select all

Description
XQST0059: ro.sync.net.protocol.http.HttpExceptionWithDetails: 404 Not Found for: http://www.oxygenxml.com/ns/xmlRefactoring/resources/commons.xq

Code: Select all

XQST0059: One or more static errors were reported during query analysis
It's not the first time I get an error like this. Until now, only some XML Refactoring methods have worked for me.

Re: WebHelp Responsive: Related Links as one category

Posted: Thu Dec 15, 2016 6:49 pm
by alin
Hello,

It seems that you have disabled the "XML Refactoring" Document Type. Go to Options -> Preferences / Document Type Association and see if the "XML Refactoring" DT is checked.

Regards,
Alin

Re: WebHelp Responsive: Related Links as one category

Posted: Thu Dec 15, 2016 6:55 pm
by Anonymous1
You are right, it wasn't checked. Thanks! It works now. Makes the Refactoring tool much more useful.

(if there wouldn't be this issue: post40814.html#p40814)