Home Forums DITA and XMetaL Discussion Adding a line break for each indexterm Reply To: Adding a line break for each indexterm

Derek Read

Reply to: Adding a line break for each indexterm

I think the reason the CSS for indexterm elements is like this is because there is a dialog that lets you work with these in a nice way (or you might not agree). See the “Indexterms” section of the “Topic Metadata” dialog. To open that dialog select the Insert menu then select Topic Metadata.

However, if you prefer to work with the indexterm elements directly in a topic you can modify the CSS that displays them.

There are a bunch of override CSS files but these can be difficult to find as there is a different file for each topic type and for each different version of the DITA DTDs. I also don't have access to this old release (7 is unsupported) at the moment so I'm not sure if they are in the same place as the current release. I'd say try modifying the following file as I don't think this has changed for a long time:

On a 64-bit installation of Windows with XMetaL Author Enterprise 7 installed in the default path that file should be here:
C:Program Files (x86)XMetaL 7.0AuthorDITAXACssharedditabase-base.css

Changing that file should change this for all DITA versions (1.1, 1.2, and newer versions also have 1.3) and all topic types.

Note: That this file includes the “base” DITA elements, which is where the indexterm element is defined. There is also a file for “derived” DITA elements, so if you need to alter the appearance of another element (other than indexterm) and you don't find it in ditabase-base.css look in ditabase-derived.css.

Change the following selector(s) depending on your needs…

To get indexterm elements to appear on separate lines you will need to change “inline” to “block” but you might want to make other changes.
To understand which one you are changing you might change color to “red” (color:red) to make that obvious, then change that back to the original #AAAAAA grey or something else you prefer.

After each change switch views to refresh the CSS. If that does not affect the CSS then you will need to restart XMetaL Author Enterprise to reload the CSS files.

This selector affects only indexterms inside keywords:

/* indexterm in keywords{*/
[class~="topic/keywords"] [class~="topic/indexterm"] {
display: inline;

You might also want to change this one, or maybe not depending on what you consider easiest to work with:

/* nested indexterm in keywords{*/
[class~="topic/keywords"] [class~="topic/indexterm"] [class~="topic/indexterm"] {
display: inline;

This selector affects all indexterms (provided they are not inside keywords because the selectors above are more specific and the standard W3C CSS cascading rules apply in XMetaL Author):

/* indexterm {*/
[class~="topic/indexterm"] {
display: inline;
color: #AAAAAA;

Note: The reason the class attribute is used and not simply the “indexterm” element is to allow XMetaL Author Enterprise to use the same CSS files for all DITA document types, including specialized DTDs.