WebHelp: How to achieve one-page glossary with term tooltips?

Post here questions and problems related to editing and publishing DITA content.
TumasN
Posts: 7
Joined: Sat Jun 24, 2023 7:35 pm

WebHelp: How to achieve one-page glossary with term tooltips?

Post by TumasN »

Hello.
I'd like to achieve the following result using the WebHelp transformation for the glossary:
- One resultant web page with all glossary terms
- Tooltips when the term is mentioned in other topics
I've tried many methods and I failed, ultimately I decided to seek help here...

At the moment, I had to resort to the following soluition:
Each glossary term is seen on separate page
Tooltips are displayed correctly when using <term keyref="term"/>

I achieved this by doing the following:
- Each glossary term is a separate file with a separate <glossentry> topic. For example (simplified):

topic1.dita:
<glossentry id="term1">
<glossterm>Term 1</glossterm>
<glossdef>Definition of term 1.</glossdef>
</glossentry>

glossary.ditamap
<topicref href="topic1.dita" keys="term1"/>
<topicref href="topic2.dita" keys="term2"/>
(...)

Of course, glossary.ditamap is imported into the main ditamap:

<topichead>
<topicmeta><navtitle>Glossary</navtitle></topicmeta>
<topicref href="glossary.ditamap" format="ditamap"/>
</topichead>

I tried using a single glossary definition file using <glossgroup>. However, the result was that while there was one page in the resultant HTML with all glossary terms, whenever a term was displayed, the tooltip contained the <glossdef> from the first term in the <glossgroup>. I tried doing all I can, creating keys, following the tips in this topic: dita-editing-and-publishing-dita-conten ... 15542.html -- nothing seem to have worked.

Could please someone be so kind as to explain to me very simply how do I do this? If I need to use the keys, how do I define them and import them? The simplest possible way, could be keys in main ditamap directly, one glossgroup file, and what I need to reference in the <term> elements in other topics please...

Thank you in advance!
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: WebHelp: How to achieve one-page glossary with term tooltips?

Post by ionela »

Hi,

Thank you for your feedback and all the details you have provided.
If possible, could you please send us a minimal sample file that we can use to reproduce this behavior on our side?
You can attach the sample either to this email thread or by email to support AT oxygenxml DOT com.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
TumasN
Posts: 7
Joined: Sat Jun 24, 2023 7:35 pm

Re: WebHelp: How to achieve one-page glossary with term tooltips?

Post by TumasN »

test1.zip
(3.74 KiB) Downloaded 29 times
test2.zip
(3.19 KiB) Downloaded 32 times
Two projects attached. You need to generate WebHelp cause otherwise the file was too big to be attached.
1. Tooltips are correct but each glossary term is a separate page.
2. Tooltips are incorrect (both tooltips show Term1) but all terms are on a single page.
What I want to achieve is: correct tooltips and all terms on a single page. When clicking on a term that has a tooltip, the glossary should also scroll to the term (anchor).

Thank you in advance!
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: WebHelp: How to achieve one-page glossary with term tooltips?

Post by alin »

Hello,

To achieve the desired result (i.e. all glossary terms listed on a single page) you can set the @chunk="to-content" attribute on the Gloassary <topichead> in the first example (test1).

Code: Select all

    <topichead chunk="to-content">
        <topicmeta>
            <navtitle>Glossary</navtitle>
        </topicmeta>
        <topicref href="glossary.ditamap" format="ditamap"/>
    </topichead>
In this case the glossary terms are all listed on the same HTML page, and the links and tooltips are generated correctly.



As for the second case, I am not sure that way you have referenced the terms is correct because the DITA specification is not very clear in this case:
The @keyref attribute can be used to associate a term with a resource, typically a definition of the term. The @keyref attribute can also be used to supply the text content for <term> using standard @keyref processing for variable text.
See: You have associated two keys with the same glossgroup topic, but there is no clear mapping between the two terms in the glossgroup and the two keys:

Code: Select all

<topicref keys="term1 term2" href="glossary.dita"/>
If you consider that this approach is correct you can file an issue on the DITA-OT project: https://github.com/dita-ot/dita-ot/issues

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
TumasN
Posts: 7
Joined: Sat Jun 24, 2023 7:35 pm

Re: WebHelp: How to achieve one-page glossary with term tooltips?

Post by TumasN »

Thank you, the first approach worked and it's fine. I don't mind having the topics in separate files.
Post Reply