Displaying, Grouping, and Sorting Glossentries

Post here questions and problems related to editing and publishing DITA content.
clarkbrendan
Posts: 6
Joined: Wed Mar 27, 2024 4:36 am

Displaying, Grouping, and Sorting Glossentries

Post by clarkbrendan »

Hi, I'm trying to make a simple piece of user documentation (PDF) to help robotics teams in FTC switch from using OnBot Java to Android Studio. This is mostly targeted towards established teams, but I also want to make it as accessible as possible to people who are just getting started. With that in mind, I want to make a solid list of definitions that I can easily link to and reuse.

I've decided to use glossentries as they seem to be the most modular and flexible tool available for accomplishing this. However, I can't figure out a good way to group, sort, and display these entries. I can group them into their own ditamap easily, but they do not sort themselves, and they display really badly (each term has a gigantic title and rather than just listing the definition also lists the acronyms and abbreviations on new lines). Any idea what the best way to go about this is? If someone could at least direct me toward the xsl file that is responsible for the formatting of glossentry, that would be much appreciated.

Attached are an image of what it currently looks like, and approximately what I would like it to look like respectively (keep in mind the much more slim, readable format, as well as the opposite order of the two terms because they are now sorted by term):
image.png
image.png (21.87 KiB) Viewed 320 times
image.png
image.png (14.07 KiB) Viewed 320 times
Last edited by clarkbrendan on Mon Apr 01, 2024 3:02 pm, edited 1 time in total.
clarkbrendan
Posts: 6
Joined: Wed Mar 27, 2024 4:36 am

Re: Displaying, Grouping, and Sorting Glossentries

Post by clarkbrendan »

Ignoring the grouping and sorting portion, to customize how it is displayed, I believe it's recommended to create a custom plugin and override the wsl files controlling the formatting of the specific things you want to change. However, I cannot for the life of me figure out what to change to display the glossentry differently. There are only two files I could find that even reference it (abbrev-domain.xsl, and toc.xsl) neither of which seem to be formatting it on the surface level. Can someone with more experience working with wsl files look into this with me and try to walk me through what controls this formatting and how to override it?

The only line that I felt could be doing anything regarding formatting the glossentry itself was the following in toc.xsl:
<xsl:template match="*[contains(@class, ' glossentry/glossentry ')]" mode="toc" priority="10"/>
However, I have no clue how to follow that from there or if that's even where I should be looking.
Last edited by clarkbrendan on Mon Apr 01, 2024 1:52 am, edited 1 time in total.
pplnrlt
Posts: 1
Joined: Wed Apr 10, 2024 4:57 pm

Re: Displaying, Grouping, and Sorting Glossentries

Post by pplnrlt »

Hi Clark,

I'm also looking for a solution to sort glossentries alphabetically, but I may be able to help you for the customization part!
I use the DITA Map PDF - based on HTML5 & CSS transformation scenario to generate my PDFs instead of the xsl one, if find it easier to customize. With this one, you can create a custom css file that lists the modifications you want to make to your PDF.
Here is what I added in mine to style my glossentries:

Code: Select all

/* Change the styling of glossentries title*/
*[class~="glossentry"]>*[class~="glossterm"] {
    font-size: 1.5em !important;
    font-weight: bold;
    margin-bottom: 0.2em;
    margin-top: 0.6em;
    padding-bottom: 1pt;
    border-bottom-style: none !important;
}

 /* Hide content of glossAcronym */
 *[class~="glossAcronym"] {
  display:none !important;  
}

/* Add "Full form:" before glossSurfaceForm */
*[class~="glossSurfaceForm"]:before {
  content: "Full form: " !important;  
  font-weight: bold;
  font-size: 12pt;
}

/* Add "Full form:" before glossAbbreviation */
*[class~="glossAbbreviation"]:before {
  content: "Abbreviation: " !important;  
  font-weight: bold;
  font-size: 12pt;
}

/* Remove the acronyms from the PDF bookmarks */
*[class ~= "glossentry/glossAcronym"] {
  bookmark-label: none !important;  
}

/* Remove numbering for glossentries  */
*[class~="glossentry/glossentry"]>*[class~="glossentry/glossterm"]:before {
  content: none !important;
  counter-increment: none !important;  
}
Here is what it looks like in the end:
Image
My terms appear on top of the definition, but maybe something like display: inline-block; could help you achieve what you want to do.

For the sorting part, I saw on the Oxygen Styles Basket (https://styles.oxygenxml.com/) that there was an option to sort and group glossary entries by adding the following code in your .opt file:

Code: Select all

<parameters>
            <parameter name="sort.and.group.glossentries" value="yes"/>
        </parameters>
I didn't manage to make it work exactly like I would like it too yet, but that may be a good starting point.

Hope this helps :)
Pauline
Attachments
image.png
image.png (15.79 KiB) Viewed 208 times
Post Reply