Two glossaries in PDF - HTML5/CSS output

doctissimus
Posts: 8
Joined: Tue Mar 03, 2020 11:15 pm

Two glossaries in PDF - HTML5/CSS output

Post by doctissimus » Thu Mar 05, 2020 9:00 am

Hi,

I've been adding <term> elements to topics in Oxygen 22, building each successive draft using the standard transformation for DITA Map to PDF - HTML5/CSS. After one recent pass through the OT, I noticed that my glossary now repeats, with individual entries from the first occupying their own entire page in the second (the order of these secondary glossary pages remains the same as the order of the original entries).

I figure I'm doing something wrong with my glossary submap, but I'm still too much of a newbie to get past the duh. Here's some pseudo-code to illustrate what I have:

Code: Select all

<topicref href="topics/c_glossary.dita" chunk="to-content">
	<topicref href="topics/g_aaa.dita" toc="no"/>
	<topicref href="topics/g_bbb.dita" toc="no"/>
	<topicref href="topics/g_ccc.dita" toc="no"/>
</topicref> 
<glossref keys="aaa" href="topics/g_aaa.dita" print="yes"/>
<glossref keys="bbb" href="topics/g_bbb.dita" print="yes"/>
<glossref keys="ccc" href="topics/g_ccc.dita" print="yes"/>
A typical <term> looks something like:

Code: Select all

<p>
	There are some problems with the <term keyref="aaa"/> process.
</p>
Any insight is appreciated.

Thanks,

doctissimus

julien_lacour
Posts: 84
Joined: Wed Oct 16, 2019 3:47 pm

Re: Two glossaries in PDF - HTML5/CSS output

Post by julien_lacour » Thu Mar 05, 2020 5:39 pm

Hello,

You just need to declare your glossentry as glossref inside your map before referring them using keyrefs.
If you add them into a topic with @chunk="to-content" their content will be merged inside the parent topic as one single topic (here inside "c_glossary.dita" - see DITA Documentation).
On the other hand, when you declare the glossref, in the PDF output each entry will be expanded (displayed) on one page.

Code: Select all

<topicref href="topics/c_glossary.dita"/>
<glossref keys="aaa" href="topics/g_aaa.dita" print="yes"/>
<glossref keys="bbb" href="topics/g_bbb.dita" print="yes"/>
<glossref keys="ccc" href="topics/g_ccc.dita" print="yes"/>
If you do not want one entry on one page you can simply customize the CSS used by the transformation and add it in your transformation using the "args.css" DITA parameter (after duplicating the default transformation).
The customization should contains the following selector:

Code: Select all

*[class ~= "map/map"] > *[class ~= "topic/topic"]:not([is-chapter]){
  	page-break-before: avoid;
}
Please note that you can debug your CSS using your favorite browser.

Regards,
Julien

doctissimus
Posts: 8
Joined: Tue Mar 03, 2020 11:15 pm

Re: Two glossaries in PDF - HTML5/CSS output

Post by doctissimus » Thu Mar 05, 2020 10:49 pm

Hi Julien,

Wow, that's great to know. Thanks very much for this information.

I'll try those suggestions, including the CSS debugging tip, and post back here if I have any further problems.

Thanks,

doctissimus

doctissimus
Posts: 8
Joined: Tue Mar 03, 2020 11:15 pm

Re: Two glossaries in PDF - HTML5/CSS output

Post by doctissimus » Fri Mar 06, 2020 10:35 pm

Hi all,

Thanks to Julien's help, I managed to get all those redundant glossary definitions to coalesce onto one single page. There is still a duplicate glossary in my output (PDF - HTML5/CSS), but at least it now takes up only one extra page.

The relevant part of my root <map> now looks something like this:

Code: Select all

<topicgroup>
       <topicref href="topics/c_overview.dita"/>
       <topicref href="topics/t_do_this_first.dita"/>
       <topicref href="topics/r_notable_params.dita"/>
       <topicref href="topics/c_why_this_is_important.dita"/>
       <mapref href="map_glossary.ditamap"/>
</topicgroup>
The glossary <map> now contains lines like the following:

Code: Select all

<topicref href="topics/c_glossary.dita" chunk="to-content">
	<topicref href="topics/g_aaa.dita" chunk="to-content" toc="no"/>
	<topicref href="topics/g_bbb.dita" chunk="to-content" toc="no"/>
	<topicref href="topics/g_ccc.dita" chunk="to-content" toc="no"/>
</topicref> 
<glossref keys="aaa" href="topics/g_aaa.dita" print="yes"/>
<glossref keys="bbb" href="topics/g_bbb.dita" print="yes"/>
<glossref keys="ccc" href="topics/g_ccc.dita" print="yes"/>
My relative DITA cluelessness means that I'm obviously I'm still forgetting or misunderstanding something. My c_glossary.dita topic currently contains only a <title> element and one <p> within the <conbody>. I have inline <term> elements scattered throughout the topics that comprise my root <map>, each with a keyref pointing toward a <glossref> key in my glossary map.

Thanks for any insights that will help me reach an epiphany.

doctissimus

julien_lacour
Posts: 84
Joined: Wed Oct 16, 2019 3:47 pm

Re: Two glossaries in PDF - HTML5/CSS output

Post by julien_lacour » Tue Mar 10, 2020 11:36 am

Hello,

Your glossary is duplicated because you declare each element twice inside your map_glossary.ditamap:
  • Once as topicref.
  • Once as glossref.
You can keep only the glossref declarations in you case:

Code: Select all

<topicref href="topics/c_glossary.dita" chunk="to-content">
	<glossref keys="aaa" href="topics/g_aaa.dita" print="yes" toc="no"/>
	<glossref keys="bbb" href="topics/g_bbb.dita" print="yes" toc="no"/>
	<glossref keys="ccc" href="topics/g_ccc.dita" print="yes" toc="no"/>
</topicref>
Regards,
Julien

Post Reply