Skip to main content
Inspiring
May 12, 2014
Question

How to use a custom css with a ditamap?

  • May 12, 2014
  • 1 reply
  • 406 views

I'm still trying to get to grips with some DITA Frame basics and another piece of info that I would like to have is how to get the ditamap to use a custom css when it is output to xhtml with the DITA OT. Is there any simple non-super-techie way to do this without having to learn how to hack the ANT programs?

Under the StructureTools menu, there is an Import CSS styles item, but I can't find instructions on how to use it accessible to my level.

Also, is there a way to apply a company stylesheet to the Responsive html output generated with the new Publish tool? I realize the two provided templates can be modified element by element, but it does mean a lot of modification, and it would be cool if we could just invoke the stylesheets that already govern our web site so that the output could match.

Thanks to anyone who can help,

Elisa Roselli

Cambridge Imaging Systems

This topic has been closed for replies.

1 reply

ScottPrentice
Inspiring
May 12, 2014

Hi Elisa...

The short answer is .. no.

When you publish through the OT, you're just passing control off to an Ant target and the DITA-OT processing. You'd need to modify the files in the OT to use a modified CSS. Note that the "easy" way to do this is to just edit the CSS file directly in the OT file structure. The "proper" way to do it is to develop an OT plugin and set up a new Ant target that uses your styling instead of the default. You'd change the Ant target that FM uses so it calls yours (don't recall where this is but it can be done).

One thing that may be useful to know is that when you set the value of the @outputclass attribute on an element in DITA, the corresponding tag in the generated HTML is assigned a @class attribute with that same value. This lets you set "styling" in DITA that is applied to the output. You still need to get your custom class definitions ino the CSS.

The Import CSS item on the StructureTools menu has nothing to do with OT publishing (or anything that you'd likely be using).

I'm not aware of a way to apply a stylesheet to the Publish tool .. I thnk you have to go through the process of mapping styles manually. I could be wrong, and if so, hopefully someone else will jump in to help.

Cheers,

…scott